op.c:allocmy: Don’t depend on null termination
authorFather Chrysostomos <sprout@cpan.org>
Fri, 10 Oct 2014 03:32:58 +0000 (20:32 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 10 Oct 2014 21:26:45 +0000 (14:26 -0700)
This function has a len argument, but still depends on its argument’s
being null-terminated in one spot.  (All other parts of the function
use the length.)

op.c

diff --git a/op.c b/op.c
index d54651b..0f646ed 100644 (file)
--- a/op.c
+++ b/op.c
@@ -606,7 +606,9 @@ Perl_allocmy(pTHX_ const char *const name, const STRLEN len, const U32 flags)
                    PL_parser->in_my_stash,
                    (is_our
                        /* $_ is always in main::, even with our */
-                       ? (PL_curstash && !strEQ(name,"$_") ? PL_curstash : PL_defstash)
+                       ? (PL_curstash && !memEQs(name,len,"$_")
+                           ? PL_curstash
+                           : PL_defstash)
                        : NULL
                    )
     );