gv.c: Use name_end to avoid compiler warning
authorFather Chrysostomos <sprout@cpan.org>
Thu, 6 Oct 2011 05:13:35 +0000 (22:13 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 6 Oct 2011 20:01:18 +0000 (13:01 -0700)
In this code path, name_cursor could be uninitialised if
gv_fetchpvn_flags is called with GV_NOTQUAL|GV_ADDWARN.  Whenever it
is initialised, it is the same as name_end by the time this part
of the function is reached.

gv.c

diff --git a/gv.c b/gv.c
index 550b258..f4b4b2a 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -1643,7 +1643,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
 
     if (add & GV_ADDWARN)
        Perl_ck_warner_d(aTHX_ packWARN(WARN_INTERNAL), "Had to create %"SVf" unexpectedly",
-                SVfARG(newSVpvn_flags(nambeg, name_cursor-nambeg, SVs_TEMP | is_utf8 )));
+                SVfARG(newSVpvn_flags(nambeg, name_end-nambeg, SVs_TEMP | is_utf8 )));
     gv_init_pvn(gv, stash, name, len, (add & GV_ADDMULTI)|is_utf8);
 
     if ( isIDFIRST_lazy_if(name, is_utf8)