ntdll: Only call putenv() if we are going to call exec().
If we aren't going to exec (if pre_exec() returns zero), we will continue using the envp pointer we got from the caller. However, the putenv() call does update the environment, and this can in some cases overwrite the array that the old (stale, potentially dangling) envp pointer points to. Signed-off-by: Martin Storsjo <martin@martin.st> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2306efc3fa
commit
e8f2c2464a
|
@ -1685,14 +1685,14 @@ void __wine_main( int argc, char *argv[], char *envp[] )
|
|||
|
||||
if (!getenv( "WINELOADERNOEXEC" )) /* first time around */
|
||||
{
|
||||
static char noexec[] = "WINELOADERNOEXEC=1";
|
||||
|
||||
putenv( noexec );
|
||||
check_command_line( argc, argv );
|
||||
if (pre_exec())
|
||||
{
|
||||
static char noexec[] = "WINELOADERNOEXEC=1";
|
||||
char **new_argv = malloc( (argc + 2) * sizeof(*argv) );
|
||||
|
||||
memcpy( new_argv + 1, argv, (argc + 1) * sizeof(*argv) );
|
||||
putenv( noexec );
|
||||
loader_exec( argv0, new_argv, client_cpu );
|
||||
fatal_error( "could not exec the wine loader\n" );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue