Tweak to Encode.xs to avoid buffer overrun.
Nick Ing-Simmons [Sat, 20 Apr 2002 07:46:11 +0000 (07:46 +0000)]
p4raw-id: //depot/perlio@16014

ext/Encode/Encode.xs

index 1725db9..b42668b 100644 (file)
@@ -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;