]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
Fix bug [ 1157791 ] Segfault in mountd.
authorgmorris <gmorris>
Sun, 6 Mar 2005 16:27:36 +0000 (16:27 +0000)
committergmorris <gmorris>
Sun, 6 Mar 2005 16:27:36 +0000 (16:27 +0000)
support/nfs/cacheio.c

index 33231b01e1daae34cbff3933224b307978b7be37..d7ad4293762f4b6dd583fec668cb0ea9df47b733 100644 (file)
@@ -205,16 +205,17 @@ int readline(int fd, char **buf, int *lenp)
         */
                char *new;
                int nl;
-               *lenp += 128;
+               *lenp *= 2;
                new = realloc(*buf, *lenp);
                if (new == NULL)
                        return 0;
-               nl = read(fd, *buf +len, *lenp - len);
-               if (nl <= 0 )
+               *buf = new;
+               nl = read(fd, *buf + len, *lenp - len);
+               if (nl <= 0)
                        return 0;
-               new += nl;
+               len += nl;
        }
-       (*buf)[len-1] = 0;
+       (*buf)[len-1] = '\0';
        return 1;
 }