summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-02-22 17:36:26 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-02-22 17:36:26 +0000
commit499ccf8db2d9b5a221a309256faacdec1485973e (patch)
tree4c25996699b23c3f771e7fe0e44d7dd2b344ea4c
parent548848181b3a21c4d3a3ea8f57b9166fab43b0d1 (diff)
downloadperl-499ccf8db2d9b5a221a309256faacdec1485973e.tar.gz
fix memory overrun due to off-by-one in change#5192
p4raw-link: @5192 on //depot/perl: 012bcf8d26492bcf446b8c77c363cfa2f1a6a609 p4raw-id: //depot/perl@5205
-rw-r--r--toke.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/toke.c b/toke.c
index bdf8e516ce..11e966f6d6 100644
--- a/toke.c
+++ b/toke.c
@@ -1298,9 +1298,9 @@ S_scan_const(pTHX_ char *start)
(void)utf8_to_uv((U8*)s, &len);
if (len == 1) {
/* illegal UTF8, make it valid */
- /* need to grow with 1 char to be safe */
char *old_pvx = SvPVX(sv);
- d = SvGROW(sv, SvCUR(sv)+2) + (d - old_pvx);
+ /* need space for two characters and a null */
+ d = SvGROW(sv, SvCUR(sv) + 2 + 1) + (d - old_pvx);
d = (char*)uv_to_utf8((U8*)d, (U8)*s++);
}
else {