summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2004-01-19 23:41:37 +0000
committerDave Mitchell <davem@fdisolutions.com>2004-01-19 23:41:37 +0000
commit1bf2966364b6356e9050b17d8920dd4a8ce27d97 (patch)
tree59c593eabb42816327b7d1084be6074b9bf435a9 /mg.c
parentd0a21e0008d063055a75cb0839423bc677ec5a5a (diff)
downloadperl-1bf2966364b6356e9050b17d8920dd4a8ce27d97.tar.gz
change #22071 (taint bug in $^0) introduced a potential double
free(), because PL_osname may get freed but not nulled if a taint test fails in between. Mea cupla and all that... p4raw-link: @22071 on //depot/perl: 3511154c18a0900e8873e8e72a4b74931525e718 p4raw-id: //depot/perl@22181
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mg.c b/mg.c
index f79210e5f0..9f3075d655 100644
--- a/mg.c
+++ b/mg.c
@@ -2091,14 +2091,14 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
break;
case '\017': /* ^O */
if (*(mg->mg_ptr+1) == '\0') {
- if (PL_osname)
+ if (PL_osname) {
Safefree(PL_osname);
+ PL_osname = Nullch;
+ }
if (SvOK(sv)) {
TAINT_PROPER("assigning to $^O");
PL_osname = savepv(SvPV(sv,len));
}
- else
- PL_osname = Nullch;
}
else if (strEQ(mg->mg_ptr, "\017PEN")) {
if (!PL_compiling.cop_io)