From: Stanislav Malyshev Date: Thu, 20 Sep 2007 22:35:24 +0000 (+0000) Subject: better fix for iconv_substr X-Git-Tag: php-5.2.5RC1~114 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7985002fc694ee6dcca628cbf83a9cc6b546e7ab;p=php better fix for iconv_substr --- diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index 52b95e186d..2aca0b5cc0 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -700,7 +700,12 @@ static php_iconv_err_t _php_iconv_substr(smart_str *pretval, } } - if (offset >= total_len || len > total_len) { + if(len > total_len) { + len = total_len; + } + + + if (offset >= total_len) { return PHP_ICONV_ERR_SUCCESS; }