From: Nick Ing-Simmons Date: Sat, 20 Apr 2002 07:46:11 +0000 (+0000) Subject: Tweak to Encode.xs to avoid buffer overrun. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0172fc7f023949162f3e79310fb0db0dd22a98f1;p=p5sagit%2Fp5-mst-13.2.git Tweak to Encode.xs to avoid buffer overrun. p4raw-id: //depot/perlio@16014 --- diff --git a/ext/Encode/Encode.xs b/ext/Encode/Encode.xs index 1725db9..b42668b 100644 --- a/ext/Encode/Encode.xs +++ b/ext/Encode/Encode.xs @@ -179,8 +179,8 @@ encode_method(pTHX_ encode_t * enc, encpage_t * dir, SV * src, } } /* settle variables when fallback */ - dlen = SvCUR(dst); - d = (U8*)SvPVX(dst) + dlen; + d = (U8*)SvEND(dst); + dlen = SvLEN(dst)-ddone-1; s = (U8*)SvPVX(src) + sdone; slen = tlen - sdone; break;