Fix nullptr dereference in front of nullptr check in FS_CheckPak0

Found using LLVM sanitizer. Reported by Dominic "lonkamikaze" Fandrey
and David "devnexen" CARLIER.
This commit is contained in:
Zack Middleton 2018-04-08 20:52:19 -05:00
parent 9f294ce520
commit 4ea0eebfe5

View file

@ -3458,17 +3458,17 @@ static void FS_CheckPak0( void )
{ {
searchpath_t *path; searchpath_t *path;
pack_t *curpack; pack_t *curpack;
const char *pakBasename;
qboolean founddemo = qfalse; qboolean founddemo = qfalse;
unsigned int foundPak = 0, foundTA = 0; unsigned int foundPak = 0, foundTA = 0;
for( path = fs_searchpaths; path; path = path->next ) for( path = fs_searchpaths; path; path = path->next )
{ {
const char* pakBasename = path->pack->pakBasename;
if(!path->pack) if(!path->pack)
continue; continue;
curpack = path->pack; curpack = path->pack;
pakBasename = curpack->pakBasename;
if(!Q_stricmpn( curpack->pakGamename, "demoq3", MAX_OSPATH ) if(!Q_stricmpn( curpack->pakGamename, "demoq3", MAX_OSPATH )
&& !Q_stricmpn( pakBasename, "pak0", MAX_OSPATH )) && !Q_stricmpn( pakBasename, "pak0", MAX_OSPATH ))