From: Gurusamy Sarathy <gsar@cpan.org>
Date: Tue, 22 Feb 2000 17:50:44 +0000 (+0000)
Subject: change#5205 wasn't quite right; SvCUR() should be SvLEN()
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bee7c419e4a9bbc7a5c74bf12fec909da7238b19;p=p5sagit%2Fp5-mst-13.2.git

change#5205 wasn't quite right; SvCUR() should be SvLEN()

p4raw-link: @5205 on //depot/perl: 499ccf8db2d9b5a221a309256faacdec1485973e

p4raw-id: //depot/perl@5206
---

diff --git a/toke.c b/toke.c
index 11e966f..a7ceba3 100644
--- 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 {