summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-05-15 12:44:06 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-05-15 12:44:06 +0000
commit13817fc8ca76d121dbf08724800333ebb50f5d64 (patch)
tree710f56e66989a0f42ae524e176cb3906536a9ac6 /sv.c
parent238ae7127bc19e64a92badbfc0a4b72cf6ded32b (diff)
downloadperl-13817fc8ca76d121dbf08724800333ebb50f5d64.tar.gz
Purify finding: jperl.t causes a few Array Bounds Reads
(one byte too far in a malloced buffer) at various spots in regcomp.c, all the buffers malloced by SvGROW() in sv_recode_to_utf8(). p4raw-id: //depot/perl@16608
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sv.c b/sv.c
index 13b548bd5e..5992a69b2f 100644
--- a/sv.c
+++ b/sv.c
@@ -10474,9 +10474,10 @@ Perl_sv_recode_to_utf8(pTHX_ SV *sv, SV *encoding)
PUTBACK;
s = SvPV(uni, len);
if (s != SvPVX(sv)) {
- SvGROW(sv, len);
+ SvGROW(sv, len + 1);
Move(s, SvPVX(sv), len, char);
SvCUR_set(sv, len);
+ SvPVX(sv)[len] = 0;
}
FREETMPS;
LEAVE;