diff --git a/Quake/pr_cmds.c b/Quake/pr_cmds.c index ac8344ca..ff886623 100644 --- a/Quake/pr_cmds.c +++ b/Quake/pr_cmds.c @@ -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;