mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
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:
parent
182369ca03
commit
2d394e7a29
1 changed files with 4 additions and 0 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue