projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f12724c
)
Fix a bug in get_line_from_file. If the length of the line is (GROWBY * n) +
author
Eric Andersen
<andersen@codepoet.org>
Sun, 9 Jul 2000 02:38:01 +0000
(
02:38
-0000)
committer
Eric Andersen
<andersen@codepoet.org>
Sun, 9 Jul 2000 02:38:01 +0000
(
02:38
-0000)
GROWBY - 1, then it writes the null character just after the buffer. Yipe.
Fix thanks to Matt Kraai <kraai@alumni.carnegiemellon.edu> Thanks Matt!
-Erik
utility.c
patch
|
blob
|
history
diff --git
a/utility.c
b/utility.c
index 3dedc2c71493d18c2ba78cb14f66a40e0202d137..a15ae68dafd56e7789916783f369f4a6ac38bcfa 100644
(file)
--- a/
utility.c
+++ b/
utility.c
@@
-1616,7
+1616,7
@@
extern char *get_line_from_file(FILE *file)
if (ch == EOF)
break;
/* grow the line buffer as necessary */
- if (idx > linebufsz-
1
)
+ if (idx > linebufsz-
2
)
linebuf = realloc(linebuf, linebufsz += GROWBY);
linebuf[idx++] = (char)ch;
if ((char)ch == '\n')