From ae6b6b71cdbfb3fb6e1192178fa1e530a2f07ece Mon Sep 17 00:00:00 2001 From: Tomasz Konojacki Date: Tue, 19 Apr 2022 16:41:23 +0200 Subject: make PERL_USE_SAFE_PUTENV the default and the only option Now environ isn't owned by Perl and calling setenv/putenv in XS code will no longer result in memory corruption. Fixes #19399 --- miniperlmain.c | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'miniperlmain.c') diff --git a/miniperlmain.c b/miniperlmain.c index 4edd4d1852..d5708c7497 100644 --- a/miniperlmain.c +++ b/miniperlmain.c @@ -73,9 +73,6 @@ main(int argc, char **argv, char **env) #ifndef NO_ENV_ARRAY_IN_MAIN PERL_UNUSED_ARG(env); #endif -#ifndef PERL_USE_SAFE_PUTENV - PL_use_safe_putenv = FALSE; -#endif /* PERL_USE_SAFE_PUTENV */ /* if user wants control of gprof profiling off by default */ /* noop unless Configure is given -Accflags=-DPERL_GPROF_CONTROL */ @@ -128,19 +125,6 @@ main(int argc, char **argv, char **env) perl_free(my_perl); -#if defined(USE_ENVIRON_ARRAY) && defined(PERL_TRACK_MEMPOOL) && !defined(NO_ENV_ARRAY_IN_MAIN) - /* - * The old environment may have been freed by perl_free() - * when PERL_TRACK_MEMPOOL is defined, but without having - * been restored by perl_destruct() before (this is only - * done if destruct_level > 0). - * - * It is important to have a valid environment for atexit() - * routines that are eventually called. - */ - environ = env; -#endif - PERL_SYS_TERM(); exit(exitstatus); -- cgit v1.2.1