From 4ed6e04490a689556f7f9a6c74f3256c00d5f67c Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 25 Aug 2008 08:35:42 +0000 Subject: * transcode.c (rb_econv_substr_append): fix for buffer overrun. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- transcode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'transcode.c') diff --git a/transcode.c b/transcode.c index 519c2f8c6..ddb185cc7 100644 --- a/transcode.c +++ b/transcode.c @@ -1360,8 +1360,9 @@ rb_econv_substr_append(rb_econv_t *ec, VALUE src, long off, long len, VALUE dst, } ss = sp = (const unsigned char *)RSTRING_PTR(src) + off; se = ss + len; - ds = dp = (unsigned char *)RSTRING_PTR(dst) + dlen; + ds = (unsigned char *)RSTRING_PTR(dst); de = ds + rb_str_capacity(dst); + dp = ds += dlen; res = rb_econv_convert(ec, &sp, se, &dp, de, flags); off += sp - ss; len -= sp - ss; -- cgit