PF_lightstyle: add bounds check to avoid clobbering memory

Found when trying to load e1-4.bsp from https://github.com/plankatron/quakemash

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1390 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Eric Wasylishen 2017-04-01 21:31:07 +00:00
parent 182369ca03
commit 2d394e7a29

View file

@ -1222,6 +1222,10 @@ static void PF_lightstyle (void)
style = G_FLOAT(OFS_PARM0);
val = G_STRING(OFS_PARM1);
// bounds check to avoid clobbering sv struct
if (style < 0 || style >= MAX_LIGHTSTYLES)
Host_Error("PF_lightstyle: style = %d", style);
// change the string in sv
sv.lightstyles[style] = val;