mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-12-21 10:20:42 +00:00
Fix buffer overflow when linedef type 415 executes
This commit is contained in:
parent
d6d424f102
commit
8919b35b93
1 changed files with 9 additions and 1 deletions
10
src/p_spec.c
10
src/p_spec.c
|
@ -2613,7 +2613,15 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo, sector_t *callsec)
|
|||
if (lumpnum == LUMPERROR || W_LumpLength(lumpnum) == 0)
|
||||
CONS_Debug(DBG_SETUP, "Line type 415 Executor: script lump %s not found/not valid.\n", line->stringargs[0]);
|
||||
else
|
||||
COM_BufInsertText(W_CacheLumpNum(lumpnum, PU_CACHE));
|
||||
{
|
||||
void *lump = W_CacheLumpNum(lumpnum, PU_CACHE);
|
||||
size_t len = W_LumpLength(lumpnum);
|
||||
char *text = Z_Malloc(len + 1, PU_CACHE, NULL);
|
||||
memcpy(text, lump, len);
|
||||
text[len] = '\0';
|
||||
COM_BufInsertText(text);
|
||||
Z_Free(text);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in a new issue