mirror of
https://github.com/UberGames/GtkRadiant.git
synced 2024-11-10 06:31:41 +00:00
q3map2: fix dangling pointer dereference
`last` was used but not initialized. Also fixes a segmentation fault if PATH is not in the environment.
This commit is contained in:
parent
d7e9dab03d
commit
808e1c9f6f
1 changed files with 4 additions and 8 deletions
|
@ -111,20 +111,16 @@ void LokiInitPaths( char *argv0 ){
|
||||||
home = ".";
|
home = ".";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
path = getenv( "PATH" );
|
||||||
|
|
||||||
/* do some path divining */
|
/* do some path divining */
|
||||||
strcpy( temp, argv0 );
|
strcpy( temp, argv0 );
|
||||||
if ( strrchr( temp, '/' ) ) {
|
if ( strrchr( temp, '/' ) ) {
|
||||||
argv0 = strrchr( argv0, '/' ) + 1;
|
argv0 = strrchr( argv0, '/' ) + 1;
|
||||||
}
|
}
|
||||||
else
|
else if ( path ) {
|
||||||
{
|
|
||||||
/* get path environment variable */
|
|
||||||
path = getenv( "PATH" );
|
|
||||||
|
|
||||||
/* minor setup */
|
|
||||||
last[ 0 ] = path[ 0 ];
|
|
||||||
last[ 1 ] = '\0';
|
|
||||||
found = qfalse;
|
found = qfalse;
|
||||||
|
last = path;
|
||||||
|
|
||||||
/* go through each : segment of path */
|
/* go through each : segment of path */
|
||||||
while ( last[ 0 ] != '\0' && found == qfalse )
|
while ( last[ 0 ] != '\0' && found == qfalse )
|
||||||
|
|
Loading…
Reference in a new issue