diff options
author | Hugo van der Sanden <hv@crypt.org> | 2002-08-04 18:40:30 +0100 |
---|---|---|
committer | hv <hv@crypt.org> | 2002-08-04 15:34:19 +0000 |
commit | a8c7c11a510ba1b065a5e57da04d34c2f89e233b (patch) | |
tree | 8322f0bc9c5da4e99e8c4a17e3c659adb284ed90 /mg.c | |
parent | 06bd180242168640a1733ced8fea2dbabcdc44d0 (diff) | |
download | perl-a8c7c11a510ba1b065a5e57da04d34c2f89e233b.tar.gz |
Re: [ID 20020704.001] my $foo = $1 won't taint $foo (with use re 'taint')
Message-id: <200208041640.g74GeUU25061@crypt.compulink.co.uk>
p4raw-id: //depot/perl@17678
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 20 |
1 files changed, 13 insertions, 7 deletions
@@ -693,18 +693,24 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) getrx: if (i >= 0) { - bool was_tainted = FALSE; - if (PL_tainting) { - was_tainted = PL_tainted; - PL_tainted = FALSE; - } sv_setpvn(sv, s, i); - if (PL_reg_match_utf8 && is_utf8_string((U8*)s, i)) + if (PL_reg_match_utf8 && is_utf8_string((U8*)s, i)) SvUTF8_on(sv); else SvUTF8_off(sv); if (PL_tainting) - PL_tainted = (was_tainted || RX_MATCH_TAINTED(rx)); + PL_tainted = PL_tainted || !!RX_MATCH_TAINTED(rx); + if (RX_MATCH_TAINTED(rx)) { + MAGIC* mg = SvMAGIC(sv); + MAGIC* mgt; + SvMAGIC(sv) = mg->mg_moremagic; + SvTAINT(sv); + if ((mgt = SvMAGIC(sv))) { + mg->mg_moremagic = mgt; + SvMAGIC(sv) = mg; + } + } else + SvTAINTED_off(sv); break; } } |