Fix bug in preprocessor line directive handling.

This commit is contained in:
Martin Whitaker 2021-03-14 10:03:08 +00:00
parent 9a2c43ec34
commit d8cb29f6e0
1 changed files with 1 additions and 1 deletions

View File

@ -777,7 +777,7 @@ static void handle_line_directive(void)
will underflow on line 1, but that's OK because we are using
unsigned arithmetic. */
assert(istack);
realloc(istack->path, fn_end-fn_start+1);
istack->path = realloc(istack->path, fn_end-fn_start+1);
strncpy(istack->path, fn_start, fn_end-fn_start);
istack->path[fn_end-fn_start] = '\0';
istack->lineno = lineno - 2;