]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
fix pk3dir/dpk/dpkdir code 81/head
authorTimothee Besset <ttimo@ttimo.net>
Mon, 22 Jan 2018 15:03:45 +0000 (09:03 -0600)
committerThomas Debesse <dev@illwieckz.net>
Tue, 23 Jan 2018 03:14:28 +0000 (04:14 +0100)
tools/quake3/common/vfs.c

index 775f9bd0e8c56a19a496e5ced060f7d7e5a84011..65a8b6f4275b84f249cb517e8facd6b463cbb826 100644 (file)
@@ -224,18 +224,18 @@ void vfsInitDirectory( const char *path ){
                                {
                                        char *ext = strrchr( dirlist, '.' );
 
                                {
                                        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 );
                                                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;
                                        }
 
                                                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;
                                        }
                                }
                                                continue;
                                        }
                                }