mirror of
https://github.com/openbsd/src.git
synced 2024-12-22 16:42:56 -08:00
NUL-terminate buffer in compiler_text() after realloc, not before.
Now that we have dynamically sized buffers there may not be room for the NUL until after realloc.
This commit is contained in:
parent
88955b2882
commit
1d6c415822
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: compile.c,v 1.33 2010/07/01 17:04:24 naddy Exp $ */
|
||||
/* $OpenBSD: compile.c,v 1.34 2010/11/15 20:26:00 millert Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992 Diomidis Spinellis.
|
||||
@ -685,8 +685,9 @@ compile_text(void)
|
||||
}
|
||||
}
|
||||
free(lbuf);
|
||||
text = xrealloc(text, size + 1);
|
||||
text[size] = '\0';
|
||||
return (xrealloc(text, size + 1));
|
||||
return (text);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user