]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Ensure that a given buffer is at least BUFSIZ.
authorRoy Marples <roy@marples.name>
Mon, 21 Jul 2014 19:05:32 +0000 (19:05 +0000)
committerRoy Marples <roy@marples.name>
Mon, 21 Jul 2014 19:05:32 +0000 (19:05 +0000)
compat/getline.c

index 68fe08545815bf0ddcee6a91baf874abaf00a028..8c0cbdff9e35de84c22c3d1e2a251a377aa6fc69 100644 (file)
@@ -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)