diff options
author | Zefram <zefram@fysh.org> | 2017-12-16 05:33:20 +0000 |
---|---|---|
committer | Zefram <zefram@fysh.org> | 2017-12-16 05:33:20 +0000 |
commit | 64def2aeaeb63f92dadc6dfa33486c1d7b311963 (patch) | |
tree | 0c5733662aef0751a689d1c295154f4770a9fe7e /pp_sys.c | |
parent | 52e58e76455a7593547f41dc02823f4b5f83185c (diff) | |
download | perl-64def2aeaeb63f92dadc6dfa33486c1d7b311963.tar.gz |
perform system() arg processing before fork
A lot of things can happen when stringifying an argument list: side
effects, warnings, exceptions. In the case of system(), these effects
should happen in the context of the parent process. The stringification
can also depend on which process it happens in, as in the case of
$$, and in that case it should also happen in the parent process.
Therefore reduce the argument scalars to strings first thing in pp_system.
Fixes [perl #121105].
Diffstat (limited to 'pp_sys.c')
-rw-r--r-- | pp_sys.c | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -4392,14 +4392,18 @@ PP(pp_system) int result; # endif + while (++MARK <= SP) { + SV *origsv = *MARK; + STRLEN len; + char *pv; + pv = SvPV(origsv, len); + *MARK = newSVpvn_flags(pv, len, + (SvFLAGS(origsv) & SVf_UTF8) | SVs_TEMP); + } + MARK = ORIGMARK; + if (TAINTING_get) { TAINT_ENV(); - while (++MARK <= SP) { - (void)SvPV_nolen_const(*MARK); /* stringify for taint check */ - if (TAINT_get) - break; - } - MARK = ORIGMARK; TAINT_PROPER("system"); } PERL_FLUSHALL_FOR_CHILD; |