Make FS_InvalidGameDir() consider subdirectories invalid

fs_game shouldn't be a subdirectory and it simplifies the code.
This commit is contained in:
Zack Middleton 2018-02-04 20:34:05 -06:00
parent 3d6aa05694
commit 71a9a5efa6

View file

@ -3072,13 +3072,12 @@ qboolean FS_CheckDirTraversal(const char *checkdir)
FS_InvalidGameDir FS_InvalidGameDir
return true if path is a reference to current directory or directory traversal return true if path is a reference to current directory or directory traversal
or a sub-directory
================ ================
*/ */
qboolean FS_InvalidGameDir( const char *gamedir ) { qboolean FS_InvalidGameDir( const char *gamedir ) {
if ( !strcmp( gamedir, "." ) || !strcmp( gamedir, ".." ) if ( !strcmp( gamedir, "." ) || !strcmp( gamedir, ".." )
|| !strcmp( gamedir, "/" ) || !strcmp( gamedir, "\\" ) || strchr( gamedir, '/' ) || strchr( gamedir, '\\' ) ) {
|| strstr( gamedir, "/.." ) || strstr( gamedir, "\\.." )
|| FS_CheckDirTraversal( gamedir ) ) {
return qtrue; return qtrue;
} }