summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-15 06:23:14 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-15 06:23:14 +0000
commitca99b96bc9d2a0c8dc2c9cf8c8b56d58b606e723 (patch)
treec419b042372741acb18dd3cd77a4f4da3fc84db6 /ext
parent9e8badfc59eabd65233eb524a727b19774c634c4 (diff)
* 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/branches/ruby_1_8@15482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/iconv/iconv.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index f268c7dcc5..fe02df1ce7 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -423,8 +423,11 @@ iconv_convert
length = 0;
else if ((length -= start) < 0)
length = 0;
- else
+ else {
inptr += start;
+ if (length > slen)
+ length = slen;
+ }
}
instart = inptr;
inlen = length;