From 0bd55fbf794d11385bcc64b01b81e8e478295bad Mon Sep 17 00:00:00 2001 From: Andrey Nazarov Date: Mon, 5 May 2008 21:18:52 +0000 Subject: Brought SDL window resizing policy in compliance to ICCCM. Renamed `vid_placement' cvar to `vid_geometry'. Load *.pkz files by default. Do not allow backed-up quake paths at all. Apply `--enable-dsound' and `--enable-dinput' options to Unix too. Replaced `s_driver' and `in_driver' cvars with `s_direct' and `in_direct'. Renamed `s_initsound' cva to `s_enable'. Improved SDL input grabs handling in windowed mode. Allow `cl_noskins' to be dynamically changed. Run client at 10 fps if minimuzed, at 60 fps if not active (client is disconnected or in background). Fixed Sys_ExecDefault. Use absolute mouse positioning for UI. Hide custom UI cursor in windowed mode. --- source/files.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'source/files.c') diff --git a/source/files.c b/source/files.c index 34a07d5..4f9974a 100644 --- a/source/files.c +++ b/source/files.c @@ -224,7 +224,6 @@ static fsFile_t *FS_FileForHandle( fileHandle_t f ) { qboolean FS_ValidatePath( const char *s ) { const char *start; - int back; // check for leading slash // check for empty path @@ -237,10 +236,7 @@ qboolean FS_ValidatePath( const char *s ) { while( *s ) { // check for ".." if( *s == '.' && s[1] == '.' ) { - if( back > 1 ) { - return qfalse; - } - back++; // allow one level back + return qfalse; } if( *s == '/' || *s == '\\' ) { // check for two slashes in a row @@ -1569,10 +1565,10 @@ static void q_printf( 2, 3 ) FS_AddGameDirectory( int mode, const char *fmt, ... #if USE_ZLIB // - // add any zip files in the format *.pk2 + // add any zip files in the format *.pkz // if( !( fs_restrict_mask->integer & 4 ) ) { - FS_LoadPackFiles( mode, ".pk2", FS_LoadZipFile ); + FS_LoadPackFiles( mode, ".pkz", FS_LoadZipFile ); } #endif } @@ -1754,6 +1750,12 @@ void **FS_ListFiles( const char *path, } } + count = 0; + + if( numFiles ) { + *numFiles = 0; + } + if( !path ) { path = ""; pathlen = 0; @@ -1761,15 +1763,13 @@ void **FS_ListFiles( const char *path, if( *path == '/' ) { path++; } + if( !FS_ValidatePath( path ) ) { + FS_DPrintf( "%s: refusing invalid path: %s\n", __func__, path ); + return NULL; + } pathlen = strlen( path ); } - count = 0; - - if( numFiles ) { - *numFiles = 0; - } - for( search = fs_searchpaths; search; search = search->next ) { if( flags & FS_PATH_MASK ) { if( ( flags & search->mode & FS_PATH_MASK ) == 0 ) { @@ -2165,7 +2165,7 @@ void FS_Path_f( void ) { #if USE_ZLIB if( !( fs_restrict_mask->integer & 4 ) ) { - Com_Printf( "%i files in PK2 files\n", numFilesInPK2 ); + Com_Printf( "%i files in PKZ files\n", numFilesInPK2 ); } #endif } @@ -2613,13 +2613,13 @@ void FS_Init( void ) { Cmd_Register( c_fs ); fs_debug = Cvar_Get( "fs_debug", "0", 0 ); - fs_restrict_mask = Cvar_Get( "fs_restrict_mask", "4", CVAR_NOSET ); + fs_restrict_mask = Cvar_Get( "fs_restrict_mask", "0", CVAR_NOSET ); if( ( fs_restrict_mask->integer & 7 ) == 7 ) { Com_WPrintf( "Invalid fs_restrict_mask value %d. " "Falling back to default.\n", fs_restrict_mask->integer ); - Cvar_SetInteger( "fs_restrict_mask", 4 ); + Cvar_Set( "fs_restrict_mask", "0" ); } // start up with baseq2 by default -- cgit v1.2.3