From 748beee825447256e1aa7dd1458ba317fabbd18f Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 15 Feb 2008 06:23:14 +0000 Subject: * ext/iconv/iconv.c (iconv_convert): check upper bound. a patch from Daniel Luz at [ruby-Bugs-17910]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/iconv/iconv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ext/iconv') diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index ed46234077..9f4c23b435 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -380,8 +380,11 @@ iconv_convert(iconv_t cd, VALUE str, int start, int length, int toidx, struct ic length = 0; else if ((length -= start) < 0) length = 0; - else + else { inptr += start; + if (length > slen) + length = slen; + } } instart = inptr; inlen = length; -- cgit v1.2.3