From: Jarkko Hietaniemi Date: Wed, 15 May 2002 12:44:06 +0000 (+0000) Subject: Purify finding: jperl.t causes a few Array Bounds Reads X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=13817fc8ca76d121dbf08724800333ebb50f5d64;p=p5sagit%2Fp5-mst-13.2.git 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 --- diff --git a/sv.c b/sv.c index 13b548b..5992a69 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;