mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-17 09:32:33 +00:00
Merge branch 'fix-buffer-overflow-hud-string' into 'next'
Fix segfault when passing a long string to v.drawString See merge request STJr/SRB2!2403
This commit is contained in:
commit
f67d349b35
1 changed files with 2 additions and 1 deletions
|
@ -180,7 +180,8 @@ static const char *CopyString(huddrawlist_h list, const char* str)
|
||||||
const char *old_offset = list->strbuf;
|
const char *old_offset = list->strbuf;
|
||||||
size_t i;
|
size_t i;
|
||||||
if (list->strbuf_capacity == 0) list->strbuf_capacity = 256;
|
if (list->strbuf_capacity == 0) list->strbuf_capacity = 256;
|
||||||
else list->strbuf_capacity *= 2;
|
while (list->strbuf_capacity <= list->strbuf_len + lenstr + 1)
|
||||||
|
list->strbuf_capacity *= 2;
|
||||||
list->strbuf = (char*) Z_Realloc(list->strbuf, sizeof(char) * list->strbuf_capacity, PU_STATIC, NULL);
|
list->strbuf = (char*) Z_Realloc(list->strbuf, sizeof(char) * list->strbuf_capacity, PU_STATIC, NULL);
|
||||||
|
|
||||||
// align the string pointers to make sure old pointers don't point towards invalid addresses
|
// align the string pointers to make sure old pointers don't point towards invalid addresses
|
||||||
|
|
Loading…
Reference in a new issue