diff options
author | Perl 5 Porters <perl5-porters@africa.nicoh.com> | 1996-09-22 17:26:57 -0400 |
---|---|---|
committer | Andy Dougherty <doughera@lafcol.lafayette.edu> | 1996-09-22 17:26:57 -0400 |
commit | aac0dd9a33370e49c678097301d76470eb5a9ac1 (patch) | |
tree | 2ce2e517f8d5f0d0c0cbe36638d39a4db1f36cdd /pp_sys.c | |
parent | 4f73262430dfb149e8d6a6804636241f465c0991 (diff) | |
download | perl-aac0dd9a33370e49c678097301d76470eb5a9ac1.tar.gz |
perl 5.003_06: pp_sys.c
Restore the 5.003 gv_fullname() and gv_efullname() functions.
Provide new 3-arg forms gv_fullname3() and gv_efullname3().
Date: Thu, 19 Sep 1996 11:58:22 -0400
From: "Randy J. Ray" <rjray@uswest.com>
Subject: Patch: Untaint FH flag and clean DATA handles
This patch adds a IOf_UNTAINT flag in sv.h, as one of the possibles
on an xpvio->xio_flags struct member. It is used to mark the given
file handle as a clean source, even when tainting is turned on.
There are also patches to pp_sys.c in pp_sysread to check this flag
before tainting data, and in pp_hot.c in do_readline for the same
reason. Lastly, it patches toke.c to automatically set this flag on
on a __DATA__ filehandle. The creation of the $pack::DATA
pseudo-filehandle is already checked against running under eval, so
this should not introduce any insecurity.
This patch *does not*:
* Add the "untaint" keyword.
Date: Sun, 22 Sep 1996 17:26:57 -0400
From: "Randy J. Ray" <rjray@uswest.com>
Subject: Patch to patch for untainting
The following patch ensures that a glob used as a filehandle that
has had the UNTAINT flag set will not carry that flag over on a
re-open. In a nutshell, a re-open of the DATA filehandle would be
considered untainted, and an object of class IO::Handle (or one of
its sub-classes) that is marked untainted with the untaint method,
then closed and re-opened, retained the untaintedness.
Date: Mon, 30 Sep 1996 00:54:37 -0400
From: Spider Boardman <spider@Orb.Nashua.NH.US>
First, with IO::untaint, the patches as posted resulted in a
miniperl which couldn't open files, so the autosplitting of the
library and the creation of Makefiles for the extensions didn't
work. Worse, it didn't just fail to open files, it dumped core.
Diffstat (limited to 'pp_sys.c')
-rw-r--r-- | pp_sys.c | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -243,6 +243,8 @@ PP(pp_open) else DIE(no_usym, "filehandle"); gv = (GV*)POPs; + if (IoFLAGS(GvIOn(gv)) & IOf_UNTAINT) /* This GV has UNTAINT previously set */ + IoFLAGS(GvIOp(gv)) &= ~IOf_UNTAINT; /* Clear it. We don't carry that over */ tmps = SvPV(sv, len); if (do_open(gv, tmps, len, FALSE, 0, 0, Nullfp)) { IoLINES(GvIOp(gv)) = 0; @@ -751,7 +753,7 @@ PP(pp_select) else { GV **gvp = (GV**)hv_fetch(hv, GvNAME(egv), GvNAMELEN(egv), FALSE); if (gvp && *gvp == egv) - gv_efullname(TARG, defoutgv, Nullch); + gv_efullname3(TARG, defoutgv, Nullch); else sv_setsv(TARG, sv_2mortal(newRV((SV*)egv))); XPUSHTARG; @@ -845,7 +847,7 @@ PP(pp_enterwrite) if (!cv) { if (fgv) { SV *tmpsv = sv_newmortal(); - gv_efullname(tmpsv, fgv, Nullch); + gv_efullname3(tmpsv, fgv, Nullch); DIE("Undefined format \"%s\" called",SvPVX(tmpsv)); } DIE("Not a format reference"); @@ -924,7 +926,7 @@ PP(pp_leavewrite) cv = GvFORM(fgv); if (!cv) { SV *tmpsv = sv_newmortal(); - gv_efullname(tmpsv, fgv, Nullch); + gv_efullname3(tmpsv, fgv, Nullch); DIE("Undefined top format \"%s\" called",SvPVX(tmpsv)); } return doform(cv,gv,op); @@ -981,7 +983,7 @@ PP(pp_prtf) gv = defoutgv; if (!(io = GvIO(gv))) { if (dowarn) { - gv_fullname(sv, gv, Nullch); + gv_fullname3(sv, gv, Nullch); warn("Filehandle %s never opened", SvPV(sv,na)); } SETERRNO(EBADF,RMS$_IFI); @@ -989,7 +991,7 @@ PP(pp_prtf) } else if (!(fp = IoOFP(io))) { if (dowarn) { - gv_fullname(sv, gv, Nullch); + gv_fullname3(sv, gv, Nullch); if (IoIFP(io)) warn("Filehandle %s opened only for input", SvPV(sv,na)); else @@ -1087,7 +1089,8 @@ PP(pp_sysread) *SvEND(bufsv) = '\0'; (void)SvPOK_only(bufsv); SvSETMAGIC(bufsv); - if (tainting) + /* This should not be marked tainted if the fp is marked clean */ + if (tainting && !(IoFLAGS(io) & IOf_UNTAINT)) sv_magic(bufsv, Nullsv, 't', Nullch, 0); SP = ORIGMARK; sv_setpvn(TARG, buf, bufsize); @@ -1122,7 +1125,8 @@ PP(pp_sysread) *SvEND(bufsv) = '\0'; (void)SvPOK_only(bufsv); SvSETMAGIC(bufsv); - if (tainting) + /* This should not be marked tainted if the fp is marked clean */ + if (tainting && !(IoFLAGS(io) & IOf_UNTAINT)) sv_magic(bufsv, Nullsv, 't', Nullch, 0); SP = ORIGMARK; PUSHi(length); |