diff options
author | Dave Mitchell <davem@fdisolutions.com> | 2004-01-05 22:17:04 +0000 |
---|---|---|
committer | Dave Mitchell <davem@fdisolutions.com> | 2004-01-05 22:17:04 +0000 |
commit | 3511154c18a0900e8873e8e72a4b74931525e718 (patch) | |
tree | 7cb76ad727f258cdb759ab764d0a3e4400bc1f82 /mg.c | |
parent | 56da5a46eac515b5a165aaf05cb06f7bcdfd8e67 (diff) | |
download | perl-3511154c18a0900e8873e8e72a4b74931525e718.tar.gz |
[perl #24674]
stop $^O getting tainted on read access, and disallow tainted
assignment to it
p4raw-id: //depot/perl@22071
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -648,8 +648,10 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) sv_setsv(sv, &PL_sv_undef); break; case '\017': /* ^O & ^OPEN */ - if (*(mg->mg_ptr+1) == '\0') + if (*(mg->mg_ptr+1) == '\0') { sv_setpv(sv, PL_osname); + SvTAINTED_off(sv); + } else if (strEQ(mg->mg_ptr, "\017PEN")) { if (!PL_compiling.cop_io) sv_setsv(sv, &PL_sv_undef); @@ -2091,8 +2093,10 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) if (*(mg->mg_ptr+1) == '\0') { if (PL_osname) Safefree(PL_osname); - if (SvOK(sv)) + if (SvOK(sv)) { + TAINT_PROPER("assigning to $^O"); PL_osname = savepv(SvPV(sv,len)); + } else PL_osname = Nullch; } |