mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-17 18:40:02 +00: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 );
|
FS_AddPak_Fullpath( va( "%sextras_%s.pak", SDL_GetBasePath(), GI->gamefolder ), NULL, extrasFlags );
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if( ( str = getenv( "XASH3D_EXTRAS_PAK1" ) ) )
|
str = getenv( "XASH3D_EXTRAS_PAK1" );
|
||||||
|
if( COM_CheckString( str ) )
|
||||||
FS_AddPak_Fullpath( str, NULL, extrasFlags );
|
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 );
|
FS_AddPak_Fullpath( str, NULL, extrasFlags );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -899,7 +899,9 @@ void Host_InitCommon( int argc, char **argv, const char *progname, qboolean bCha
|
|||||||
|
|
||||||
Platform_Init();
|
Platform_Init();
|
||||||
|
|
||||||
if( ( baseDir = getenv( "XASH3D_BASEDIR" ) ) )
|
baseDir = getenv( "XASH3D_BASEDIR" );
|
||||||
|
|
||||||
|
if( COM_CheckString( baseDir ) )
|
||||||
{
|
{
|
||||||
Q_strncpy( host.rootdir, baseDir, sizeof(host.rootdir) );
|
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;
|
host.rodir[0] = 0;
|
||||||
if( !Sys_GetParmFromCmdLine( "-rodir", host.rodir ))
|
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 ));
|
Q_strncpy( host.rodir, roDir, sizeof( host.rodir ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -640,7 +640,7 @@ void ID_Init( void )
|
|||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
const char *home = getenv( "HOME" );
|
const char *home = getenv( "HOME" );
|
||||||
if( home )
|
if( COM_CheckString( home ) )
|
||||||
{
|
{
|
||||||
FILE *cfg = fopen( va( "%s/.config/.xash_id", home ), "r" );
|
FILE *cfg = fopen( va( "%s/.config/.xash_id", home ), "r" );
|
||||||
if( !cfg )
|
if( !cfg )
|
||||||
@ -690,7 +690,7 @@ void ID_Init( void )
|
|||||||
#else
|
#else
|
||||||
{
|
{
|
||||||
const char *home = getenv( "HOME" );
|
const char *home = getenv( "HOME" );
|
||||||
if( home )
|
if( COM_CheckString( home ) )
|
||||||
{
|
{
|
||||||
FILE *cfg = fopen( va( "%s/.config/.xash_id", home ), "w" );
|
FILE *cfg = fopen( va( "%s/.config/.xash_id", home ), "w" );
|
||||||
if( !cfg )
|
if( !cfg )
|
||||||
|
@ -68,7 +68,7 @@ int main( int argc, char** argv )
|
|||||||
char gamedir_buf[32] = "";
|
char gamedir_buf[32] = "";
|
||||||
const char *gamedir = getenv( "XASH3D_GAMEDIR" );
|
const char *gamedir = getenv( "XASH3D_GAMEDIR" );
|
||||||
|
|
||||||
if( !gamedir )
|
if( !COM_CheckString( gamedir ) )
|
||||||
{
|
{
|
||||||
gamedir = "valve";
|
gamedir = "valve";
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ static qboolean Sys_FindExecutable( const char *baseName, char *buf, size_t size
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
envPath = getenv( "PATH" );
|
envPath = getenv( "PATH" );
|
||||||
if( !envPath )
|
if( !COM_CheckString( envPath ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
baseNameLength = Q_strlen( baseName );
|
baseNameLength = Q_strlen( baseName );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user