]> granicus.if.org Git - php/commitdiff
better fix for iconv_substr
authorStanislav Malyshev <stas@php.net>
Thu, 20 Sep 2007 22:35:24 +0000 (22:35 +0000)
committerStanislav Malyshev <stas@php.net>
Thu, 20 Sep 2007 22:35:24 +0000 (22:35 +0000)
ext/iconv/iconv.c

index 52b95e186dd00b500dc0e8e7d6a7c572ab12c50c..2aca0b5cc0d32ab26538b0a94a3ca969825c0657 100644 (file)
@@ -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;
        }