mirror of
https://github.com/FWGS/xash3d-fwgs
synced 2024-11-27 04:11:08 +01:00
engine: disallow zero-width strings for getenv()
This commit is contained in:
parent
8d942bcc86
commit
82c54b1b54
@ -1383,9 +1383,11 @@ void FS_Rescan( void )
|
||||
FS_AddPak_Fullpath( va( "%sextras_%s.pak", SDL_GetBasePath(), GI->gamefolder ), NULL, extrasFlags );
|
||||
}
|
||||
#else
|
||||
if( ( str = getenv( "XASH3D_EXTRAS_PAK1" ) ) )
|
||||
str = getenv( "XASH3D_EXTRAS_PAK1" );
|
||||
if( COM_CheckString( str ) )
|
||||
FS_AddPak_Fullpath( str, NULL, extrasFlags );
|
||||
if( ( str = getenv( "XASH3D_EXTRAS_PAK2" ) ) )
|
||||
str = getenv( "XASH3D_EXTRAS_PAK2" );
|
||||
if( COM_CheckString( str ) )
|
||||
FS_AddPak_Fullpath( str, NULL, extrasFlags );
|
||||
#endif
|
||||
|
||||
|
@ -899,7 +899,9 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
||||
|
||||
Platform_Init();
|
||||
|
||||
if( ( baseDir = getenv( "XASH3D_BASEDIR" ) ) )
|
||||
baseDir = getenv( "XASH3D_BASEDIR" );
|
||||
|
||||
if( COM_CheckString( baseDir ) )
|
||||
{
|
||||
Q_strncpy( host.rootdir, baseDir, sizeof(host.rootdir) );
|
||||
}
|
||||
@ -932,9 +934,9 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
||||
host.rodir[0] = 0;
|
||||
if( !Sys_GetParmFromCmdLine( "-rodir", host.rodir ))
|
||||
{
|
||||
char *roDir;
|
||||
char *roDir = getenv( "XASH3D_RODIR" );
|
||||
|
||||
if(( roDir = getenv( "XASH3D_RODIR" )))
|
||||
if( COM_CheckString( roDir ))
|
||||
Q_strncpy( host.rodir, roDir, sizeof( host.rodir ));
|
||||
}
|
||||
|
||||
|
@ -640,7 +640,7 @@ void ID_Init( void )
|
||||
#else
|
||||
{
|
||||
const char *home = getenv( "HOME" );
|
||||
if( home )
|
||||
if( COM_CheckString( home ) )
|
||||
{
|
||||
FILE *cfg = fopen( va( "%s/.config/.xash_id", home ), "r" );
|
||||
if( !cfg )
|
||||
@ -690,7 +690,7 @@ void ID_Init( void )
|
||||
#else
|
||||
{
|
||||
const char *home = getenv( "HOME" );
|
||||
if( home )
|
||||
if( COM_CheckString( home ) )
|
||||
{
|
||||
FILE *cfg = fopen( va( "%s/.config/.xash_id", home ), "w" );
|
||||
if( !cfg )
|
||||
|
@ -68,7 +68,7 @@ int main( int argc, char** argv )
|
||||
char gamedir_buf[32] = "";
|
||||
const char *gamedir = getenv( "XASH3D_GAMEDIR" );
|
||||
|
||||
if( !gamedir )
|
||||
if( !COM_CheckString( gamedir ) )
|
||||
{
|
||||
gamedir = "valve";
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ static qboolean Sys_FindExecutable( const char *baseName, char *buf, size_t size
|
||||
return false;
|
||||
|
||||
envPath = getenv( "PATH" );
|
||||
if( !envPath )
|
||||
if( !COM_CheckString( envPath ) )
|
||||
return false;
|
||||
|
||||
baseNameLength = Q_strlen( baseName );
|
||||
|
Loading…
Reference in New Issue
Block a user