Fix bug spotted by Jean-Christphe Dubois: reserve space for null terminator.
authorRob Landley <rob@landley.net>
Thu, 16 Apr 2009 22:03:38 +0000 (17:03 -0500)
committerRob Landley <rob@landley.net>
Thu, 16 Apr 2009 22:03:38 +0000 (17:03 -0500)
lib/lib.c

index ecef64d..e4b9d8e 100644 (file)
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -650,7 +650,7 @@ char *get_rawline(int fd, long *plen, char end)
 
        for (;;) {
                if (1>read(fd, &c, 1)) break;
-               if (!(len & 63)) buf=xrealloc(buf, len+64);
+               if (!(len & 63)) buf=xrealloc(buf, len+65);
                if ((buf[len++]=c) == end) break;
        }
        if (buf) buf[len]=0;