gl_model.c (Mod_SetExtraFlags): Fixed r_nolerp_list.string parsing code

of fitzquake: the loop was able to go beyond the null terminator of the
cvar.  (Besides, it would technically yield a false positive because of
strncmp(), but much less likely..)

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@517 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Ozkan Sezer 2011-12-14 14:21:12 +00:00
parent db8569aa86
commit 8625074bb4
4 changed files with 23 additions and 8 deletions

View file

@ -2021,6 +2021,7 @@ void Mod_SetExtraFlags (model_t *mod)
{ {
extern cvar_t r_nolerp_list; extern cvar_t r_nolerp_list;
const char *s; const char *s;
char tmp[MAX_QPATH];
int i; int i;
if (!mod || !mod->name || mod->type != mod_alias) if (!mod || !mod->name || mod->type != mod_alias)
@ -2029,17 +2030,27 @@ void Mod_SetExtraFlags (model_t *mod)
mod->flags &= 0xFF; //only preserve first byte mod->flags &= 0xFF; //only preserve first byte
// nolerp flag // nolerp flag
for (s=r_nolerp_list.string; *s; s += i+1, i=0) s = r_nolerp_list.string;
while (*s)
{ {
//search forwards to the next comma or end of string // make a copy until the next comma or end of string
for (i=0; s[i] != ',' && s[i] != 0; i++) ; i = 0;
while (*s && *s != ',')
{
if (i < MAX_QPATH - 1)
tmp[i++] = *s;
s++;
}
tmp[i] = '\0';
//compare it to the model name //compare it to the model name
if (!strncmp(mod->name, s, i)) if (!strcmp(mod->name, tmp))
{ {
mod->flags |= MOD_NOLERP; mod->flags |= MOD_NOLERP;
break; break;
} }
//search forwards to the next comma or end of string
while (*s && *s == ',')
s++;
} }
// noshadow flag (TODO: make this a cvar list) // noshadow flag (TODO: make this a cvar list)

View file

@ -11,7 +11,7 @@
<PRE> <PRE>
</PRE> </PRE>
</P> </P>
<P>QuakeSpasm 0.85.5 (12 December 2011)</P> <P>QuakeSpasm 0.85.5 (14 December 2011)</P>
<P> <P>
<H2><A NAME="toc1">1.</A> <A HREF="README.html#s1">About </A></H2> <H2><A NAME="toc1">1.</A> <A HREF="README.html#s1">About </A></H2>
@ -165,6 +165,7 @@ Compile time options include
<LI> Added support for loading external entity files, controlled by new cvar external_ents.</LI> <LI> Added support for loading external entity files, controlled by new cvar external_ents.</LI>
<LI> Made mp3 playback to allocate system memory instead of zone</LI> <LI> Made mp3 playback to allocate system memory instead of zone</LI>
<LI> Some updates to the progs interpreter code</LI> <LI> Some updates to the progs interpreter code</LI>
<LI> Fixed r_nolerp_list parsing code from fitzquake</LI>
<LI> Several code updates from uHexen2, several code cleanups.</LI> <LI> Several code updates from uHexen2, several code cleanups.</LI>
</UL> </UL>
</P> </P>

View file

@ -4,7 +4,7 @@
<toc> <toc>
<verb></verb> <verb></verb>
QuakeSpasm 0.85.5 (12 December 2011) QuakeSpasm 0.85.5 (14 December 2011)
<sect> About <p> <sect> About <p>
@ -99,6 +99,7 @@ Alternatively, have a look at <bf>Makefile.darwin</bf> for more instructions on
<item> Added support for loading external entity files, controlled by new cvar external_ents. <item> Added support for loading external entity files, controlled by new cvar external_ents.
<item> Made mp3 playback to allocate system memory instead of zone <item> Made mp3 playback to allocate system memory instead of zone
<item> Some updates to the progs interpreter code <item> Some updates to the progs interpreter code
<item> Fixed r_nolerp_list parsing code from fitzquake
<item> Several code updates from uHexen2, several code cleanups. <item> Several code updates from uHexen2, several code cleanups.
</itemize> </itemize>
</p> </p>

View file

@ -29,7 +29,7 @@
______________________________________________________________________ ______________________________________________________________________
QuakeSpasm 0.85.5 (12 December 2011) QuakeSpasm 0.85.5 (14 December 2011)
1. About 1. About
@ -171,6 +171,8 @@
o Some updates to the progs interpreter code o Some updates to the progs interpreter code
o Fixed r_nolerp_list parsing code from fitzquake
o Several code updates from uHexen2, several code cleanups. o Several code updates from uHexen2, several code cleanups.
5.2. Changes in 0.85.4 5.2. Changes in 0.85.4