ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Convert-UUlib/uulib/fptools.c
(Generate patch)

Comparing Convert-UUlib/uulib/fptools.c (file contents):
Revision 1.5 by root, Sun Mar 31 20:08:42 2002 UTC vs.
Revision 1.6 by root, Mon Aug 19 23:25:36 2002 UTC

62 return TRUE; 62 return TRUE;
63} 63}
64#endif 64#endif
65#endif 65#endif
66 66
67char * fptools_id = "$Id: fptools.c,v 1.5 2002/03/31 20:08:42 root Exp $"; 67char * fptools_id = "$Id: fptools.c,v 1.6 2002/08/19 23:25:36 root Exp $";
68 68
69/* 69/*
70 * some versions of free can't handle a NULL pointer properly 70 * some versions of free can't handle a NULL pointer properly
71 * (ANSI says, free ignores a NULL pointer, but some machines 71 * (ANSI says, free ignores a NULL pointer, but some machines
72 * prefer to SIGSEGV on it) 72 * prefer to SIGSEGV on it)
438char * TOOLEXPORT 438char * TOOLEXPORT
439_FP_fgets (char *buf, int n, FILE *stream) 439_FP_fgets (char *buf, int n, FILE *stream)
440{ 440{
441 char *obp = buf; 441 char *obp = buf;
442 int c; 442 int c;
443
444 /* shield against buffer overflows caused by "255 - bytes_left"-kind of bugs when bytes_left > 255 */
445 if (n <= 0)
446 return NULL;
443 447
444 if (feof (stream)) 448 if (feof (stream))
445 return NULL; 449 return NULL;
446 450
447 while (--n) { 451 while (--n) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines