Avoid corruption when calling mg_get to retrieve the value
Rafael Garcia-Suarez [Mon, 31 Oct 2005 16:24:31 +0000 (16:24 +0000)]
of a $digit variable. This is done by ensuring it's not
tainted.
See http://bugs.debian.org/303308
Patch by Chris Heath <chris.heath@autoweb.net>

p4raw-id: //depot/perl@25932

mg.c

diff --git a/mg.c b/mg.c
index ec4dcd3..31df285 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -841,7 +841,10 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
 
              getrx:
                if (i >= 0) {
+                   int oldtainted = PL_tainted;
+                   TAINT_NOT;
                    sv_setpvn(sv, s, i);
+                   PL_tainted = oldtainted;
                    if (RX_MATCH_UTF8(rx) && is_utf8_string((U8*)s, i))
                        SvUTF8_on(sv);
                    else