sezero / quakespasm

QuakeSpasm -- A modern, cross-platform Quake game engine based on FitzQuake.

Home Page:https://sourceforge.net/projects/quakespasm/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stack corruption when printing edicts

alexey-lysiuk opened this issue · comments

There is a potential write outside of stack buffer inside PR_ValueString() function.
To reproduce, load Oozing Blasphemy with Arcane Dimensions 1.81, and do edicts in console.

It may crash at the following line

sprintf (line, "%s", PR_GetString(val->string));
because of attempt to write more bytes than were "allocated" here
static char line[512];

Should it allocate a temporary buffer on the heap if stack one is too small?
Or, is it better to just use q_snprintf() to output only value's part?

The wad entry is ridiculously long - q_snprintf is the way to go: will apply this patch shortly

Should be fixed by commit 1c970af