X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/1f2f436a38f7ae2d39a943ad2898d8fed4ed2e58..507116e319a1470bb0a5040d4d23e5c76955ef97:/stdio/FreeBSD/fgetln.c diff --git a/stdio/FreeBSD/fgetln.c b/stdio/FreeBSD/fgetln.c index bbad594..8de4aa9 100644 --- a/stdio/FreeBSD/fgetln.c +++ b/stdio/FreeBSD/fgetln.c @@ -37,6 +37,7 @@ static char sccsid[] = "@(#)fgetln.c 8.2 (Berkeley) 1/2/94"; __FBSDID("$FreeBSD: src/lib/libc/stdio/fgetln.c,v 1.11 2007/01/09 00:28:06 imp Exp $"); #include "namespace.h" +#include #include #include #include @@ -61,6 +62,10 @@ __slbexpand(FILE *fp, size_t newsize) #endif if (fp->_lb._size >= newsize) return (0); + if (newsize > INT_MAX) { + errno = ENOMEM; + return (-1); + } if ((p = realloc(fp->_lb._base, newsize)) == NULL) return (-1); fp->_lb._base = p; @@ -159,6 +164,7 @@ fgetln(FILE *fp, size_t *lenp) error: *lenp = 0; /* ??? */ + fp->_flags |= __SERR; FUNLOCKFILE(fp); return (NULL); /* ??? */ }