summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorMalcolm Beattie <mbeattie@sable.ox.ac.uk>1997-09-22 16:01:48 +0000
committerMalcolm Beattie <mbeattie@sable.ox.ac.uk>1997-09-22 16:01:48 +0000
commitb83535cb553b94cd457aaceadbc320b293a81b7c (patch)
treefcdecfade8ccfb2652c468f025c4bc3a32791f49 /sv.c
parentd9f997d712a9ca9f2b66409f2920290ddaf904c3 (diff)
downloadperl-b83535cb553b94cd457aaceadbc320b293a81b7c.tar.gz
runops becomes a funtion pointer and sv_bless3 created
to avoid pointer forgery with '~'-magic. p4raw-id: //depot/perl@68
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sv.c b/sv.c
index cd55f817e6..1c58c46aaa 100644
--- a/sv.c
+++ b/sv.c
@@ -4043,9 +4043,10 @@ I32 n;
}
SV*
-sv_bless(sv,stash)
+sv_bless3(sv,stash,zaptilde)
SV* sv;
HV* stash;
+bool zaptilde;
{
dTHR;
SV *ref;
@@ -4058,6 +4059,8 @@ HV* stash;
if (SvOBJECT(ref)) {
if (SvTYPE(ref) != SVt_PVIO)
--sv_objcount;
+ if (zaptilde && SvRMAGICAL(ref))
+ sv_unmagic(ref, '~'); /* stop cross-class pointer forgery */
SvREFCNT_dec(SvSTASH(ref));
}
}
@@ -4077,6 +4080,14 @@ HV* stash;
return sv;
}
+SV*
+sv_bless(sv,stash)
+SV* sv;
+HV* stash;
+{
+ return sv_bless3(sv, stash, FALSE);
+}
+
static void
sv_unglob(sv)
SV* sv;