mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-06 06:48:48 +00:00
Runtime: Initializate concatenation buffer by zeros
There was a bug about stringcat-ing of empty list, where it would be filled by garbage. It seems to happen becase stringBuf.contents are used without proper check of length of the buffer. We defend from that my initializing buffer by zeros (end of string) Signed-off-by: kakadu <kakadu@pm.me>
This commit is contained in:
parent
666ca3b580
commit
d17ceb3c53
1 changed files with 1 additions and 0 deletions
|
|
@ -402,6 +402,7 @@ static StringBuf stringBuf;
|
|||
|
||||
static void createStringBuf () {
|
||||
stringBuf.contents = (char*) malloc (STRINGBUF_INIT);
|
||||
memset(stringBuf.contents, 0, STRINGBUF_INIT);
|
||||
stringBuf.ptr = 0;
|
||||
stringBuf.len = STRINGBUF_INIT;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue