libfcgi.a "fread" bug

Bob Ramstad (
Tue, 20 Aug 1996 17:51:37 -0400 (EDT)

Date: Tue, 20 Aug 1996 17:51:37 -0400 (EDT)
From: Bob Ramstad <>
Message-Id: <>
Subject: libfcgi.a "fread" bug

howdy.  the "fread" replacement when using fcgi_stdio.h should be able
to take a length of zero.  the man page for fread() on SunOS
explicitly says:

     If size or nitems is non-positive, no characters are read or
     written and 0 is returned by both fread() and fwrite().

however, this results in a divide by zero error and core dump.  the
workaround is to check for zero length before calling "fread".

-- Bob