filesystem: remove unused argument from FS_CheckNastyPath
This commit is contained in:
parent
5627dbbf34
commit
152f6d154c
1 changed files with 4 additions and 2 deletions
|
@ -403,7 +403,7 @@ Return true if the path should be rejected due to one of the following:
|
||||||
or are just not a good idea for a mod to be using.
|
or are just not a good idea for a mod to be using.
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
int FS_CheckNastyPath (const char *path, qboolean isgamedir)
|
static int FS_CheckNastyPath( const char *path )
|
||||||
{
|
{
|
||||||
// all: never allow an empty path, as for gamedir it would access the parent directory and a non-gamedir path it is just useless
|
// all: never allow an empty path, as for gamedir it would access the parent directory and a non-gamedir path it is just useless
|
||||||
if( !COM_CheckString( path )) return 2;
|
if( !COM_CheckString( path )) return 2;
|
||||||
|
@ -425,8 +425,10 @@ int FS_CheckNastyPath (const char *path, qboolean isgamedir)
|
||||||
// Windows and UNIXes: don't allow absolute paths
|
// Windows and UNIXes: don't allow absolute paths
|
||||||
if( path[0] == '/') return 2; // attempt to go outside the game directory
|
if( path[0] == '/') return 2; // attempt to go outside the game directory
|
||||||
|
|
||||||
|
#if 0
|
||||||
// all: forbid trailing slash on gamedir
|
// all: forbid trailing slash on gamedir
|
||||||
if( isgamedir && path[Q_strlen(path)-1] == '/' ) return 2;
|
if( isgamedir && path[Q_strlen(path)-1] == '/' ) return 2;
|
||||||
|
#endif
|
||||||
|
|
||||||
// all: forbid leading dot on any filename for any reason
|
// all: forbid leading dot on any filename for any reason
|
||||||
if( Q_strstr(path, "/.")) return 2; // attempt to go outside the game directory
|
if( Q_strstr(path, "/.")) return 2; // attempt to go outside the game directory
|
||||||
|
@ -1851,7 +1853,7 @@ file_t *FS_Open( const char *filepath, const char *mode, qboolean gamedironly )
|
||||||
if( filepath[0] == '/' || filepath[0] == '\\' )
|
if( filepath[0] == '/' || filepath[0] == '\\' )
|
||||||
filepath++;
|
filepath++;
|
||||||
|
|
||||||
if( FS_CheckNastyPath( filepath, false ))
|
if( FS_CheckNastyPath( filepath ))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// if the file is opened in "write", "append", or "read/write" mode
|
// if the file is opened in "write", "append", or "read/write" mode
|
||||||
|
|
Loading…
Add table
Reference in a new issue