From: Roy Marples Date: Mon, 21 Jul 2014 19:05:32 +0000 (+0000) Subject: Ensure that a given buffer is at least BUFSIZ. X-Git-Tag: v6.4.3~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=69ff5aa03ae97b8a760e7e4b204fcae27741926f;p=thirdparty%2Fdhcpcd.git Ensure that a given buffer is at least BUFSIZ. --- diff --git a/compat/getline.c b/compat/getline.c index 68fe0854..8c0cbdff 100644 --- a/compat/getline.c +++ b/compat/getline.c @@ -55,7 +55,7 @@ getline(char ** __restrict buf, size_t * __restrict buflen, do { if (feof(fp)) break; - if (*buf == NULL || bytes != 0) { + if (*buf == NULL || bytes != 0 || *buflen < BUFSIZ) { newlen = *buflen + BUFSIZ; newbuf = realloc(*buf, newlen); if (newbuf == NULL)