This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Neither gv_fetchpvn_flags() nor hv_fetch() need a NUL terminated
[perl5.git] / toke.c
diff --git a/toke.c b/toke.c
index 25c3f3e..d4930d9 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -794,19 +794,19 @@ S_incline(pTHX_ char *s)
            char *tmpbuf, *tmpbuf2;
            GV **gvp, *gv2;
            STRLEN tmplen2 = strlen(s);
-           if (tmplen + 3 < sizeof smallbuf)
+           if (tmplen + 2 < sizeof smallbuf)
                tmpbuf = smallbuf;
            else
-               Newx(tmpbuf, tmplen + 3, char);
-           if (tmplen2 + 3 < sizeof smallbuf2)
+               Newx(tmpbuf, tmplen + 2, char);
+           if (tmplen2 + 2 < sizeof smallbuf2)
                tmpbuf2 = smallbuf2;
            else
-               Newx(tmpbuf2, tmplen2 + 3, char);
+               Newx(tmpbuf2, tmplen2 + 2, char);
            tmpbuf[0] = tmpbuf2[0] = '_';
            tmpbuf[1] = tmpbuf2[1] = '<';
-           memcpy(tmpbuf + 2, cf, ++tmplen);
-           memcpy(tmpbuf2 + 2, s, ++tmplen2);
-           ++tmplen; ++tmplen2;
+           memcpy(tmpbuf + 2, cf, tmplen);
+           memcpy(tmpbuf2 + 2, s, tmplen2);
+           tmplen += 2; tmplen2 += 2;
            gvp = (GV**)hv_fetch(PL_defstash, tmpbuf, tmplen, FALSE);
            if (gvp) {
                gv2 = *(GV**)hv_fetch(PL_defstash, tmpbuf2, tmplen2, TRUE);