diff options
author | Stanislav Malyshev <stas@php.net> | 2007-09-20 22:38:25 +0000 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2007-09-20 22:38:25 +0000 |
commit | 39253a541819f2a5bb30cae4377d2a56fcbb7233 (patch) | |
tree | 9a8c82b1fdb03233043d2f0fec6778c26537695f /ext/iconv/iconv.c | |
parent | c891118ce98054233dd1b27ec61d74e3008ae710 (diff) | |
download | php-git-39253a541819f2a5bb30cae4377d2a56fcbb7233.tar.gz |
better fix for iconv_substr
Diffstat (limited to 'ext/iconv/iconv.c')
-rw-r--r-- | ext/iconv/iconv.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index 2386bdebba..9e72811510 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -765,10 +765,14 @@ 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; } - + if ((offset + len) > total_len) { /* trying to compute the length */ len = total_len - offset; |