Fix potential memory overrun...
This commit is contained in:
parent
32e95f988d
commit
285b446d17
@ -1606,7 +1606,7 @@ extern char *get_line_from_file(FILE *file)
|
|||||||
if (ch == EOF)
|
if (ch == EOF)
|
||||||
break;
|
break;
|
||||||
/* grow the line buffer as necessary */
|
/* grow the line buffer as necessary */
|
||||||
if (idx > linebufsz-2)
|
while (idx > linebufsz-2)
|
||||||
linebuf = xrealloc(linebuf, linebufsz += GROWBY);
|
linebuf = xrealloc(linebuf, linebufsz += GROWBY);
|
||||||
linebuf[idx++] = (char)ch;
|
linebuf[idx++] = (char)ch;
|
||||||
if ((char)ch == '\n')
|
if ((char)ch == '\n')
|
||||||
|
Loading…
Reference in New Issue
Block a user