diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-02-22 17:36:26 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-02-22 17:36:26 +0000 |
commit | 499ccf8db2d9b5a221a309256faacdec1485973e (patch) | |
tree | 4c25996699b23c3f771e7fe0e44d7dd2b344ea4c | |
parent | 548848181b3a21c4d3a3ea8f57b9166fab43b0d1 (diff) | |
download | perl-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.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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 { |