summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2017-12-06 21:27:15 +0000
committerZefram <zefram@fysh.org>2017-12-14 22:48:30 +0000
commit282fc0b3cc2439f69587d980b62bef7f5d5bdfef (patch)
tree6dc6abf858b4903d0adb99d6309a74f84ebf7782 /pp_sys.c
parente135ff695231a81e2a70a739e8d813525432fd4d (diff)
downloadperl-282fc0b3cc2439f69587d980b62bef7f5d5bdfef.tar.gz
make exec keep its argument list more reliably
Bits of exec code were putting the constructed commands into globals PL_Argv and PL_Cmd, which could then be clobbered by reentrancy. These are only global in order to manage their freeing, but that's better managed by using the scope stack. So replace them with automatic variables, with ENTER/SAVEFREEPV/LEAVE to free the memory. Also copy the strings acquired from SVs, to avoid magic clobbering the buffers of SVs already read. Fixes [perl #129888].
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/pp_sys.c b/pp_sys.c
index b078586974..337769b959 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -4480,7 +4480,6 @@ PP(pp_system)
(void)rsignal_restore(SIGQUIT, &qhand);
#endif
STATUS_NATIVE_CHILD_SET(result == -1 ? -1 : status);
- do_execfree(); /* free any memory child malloced on fork */
SP = ORIGMARK;
if (did_pipes) {
int errkid;
@@ -4559,7 +4558,6 @@ PP(pp_system)
if (PL_statusvalue == -1) /* hint that value must be returned as is */
result = 1;
STATUS_NATIVE_CHILD_SET(value);
- do_execfree();
SP = ORIGMARK;
XPUSHi(result ? value : STATUS_CURRENT);
#endif /* !FORK or VMS or OS/2 */