change#5205 wasn't quite right; SvCUR() should be SvLEN()
Gurusamy Sarathy [Tue, 22 Feb 2000 17:50:44 +0000 (17:50 +0000)]
p4raw-link: @5205 on //depot/perl: 499ccf8db2d9b5a221a309256faacdec1485973e

p4raw-id: //depot/perl@5206

toke.c

diff --git a/toke.c b/toke.c
index 11e966f..a7ceba3 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -1299,8 +1299,8 @@ S_scan_const(pTHX_ char *start)
           if (len == 1) {
               /* illegal UTF8, make it valid */
               char *old_pvx = SvPVX(sv);
-              /* need space for two characters and a null */
-              d = SvGROW(sv, SvCUR(sv) + 2 + 1) + (d - old_pvx);
+              /* need space for one extra char (NOTE: SvCUR() not set here) */
+              d = SvGROW(sv, SvLEN(sv) + 1) + (d - old_pvx);
               d = (char*)uv_to_utf8((U8*)d, (U8)*s++);
           }
           else {