From 6a6df29ec5e0e3cb476c9c2c77adfe3c72d0f7eb Mon Sep 17 00:00:00 2001 From: Timothee Besset Date: Mon, 22 Jan 2018 09:03:45 -0600 Subject: [PATCH] fix pk3dir/dpk/dpkdir code --- tools/quake3/common/vfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/quake3/common/vfs.c b/tools/quake3/common/vfs.c index 775f9bd0..65a8b6f4 100644 --- a/tools/quake3/common/vfs.c +++ b/tools/quake3/common/vfs.c @@ -224,18 +224,18 @@ void vfsInitDirectory( const char *path ){ { char *ext = strrchr( dirlist, '.' ); - if ( ext && ( !Q_stricmp( ext, ".pk3dir" ) || !Q_stricmp( ext, ".dpkdir" ) ) ) { + if ( ext != NULL && ( !Q_stricmp( ext, ".pk3dir" ) || !Q_stricmp( ext, ".dpkdir" ) ) ) { if ( g_numDirs == VFS_MAXDIRS ) { continue; } snprintf( g_strDirs[g_numDirs], PATH_MAX, "%s/%s", path, name ); - g_strDirs[g_numDirs][PATH_MAX] = '\0'; + g_strDirs[g_numDirs][PATH_MAX-1] = '\0'; vfsFixDOSName( g_strDirs[g_numDirs] ); vfsAddSlash( g_strDirs[g_numDirs] ); ++g_numDirs; } - if ( ( ext == NULL ) || ( Q_stricmp( ext, ".pk3" ) != 0 || !Q_stricmp( ext, ".dpk" ) != 0 ) ) { + if ( ext == NULL || ( Q_stricmp( ext, ".pk3" ) != 0 && Q_stricmp( ext, ".dpk" ) != 0 ) ) { continue; } } -- 2.39.2