1
0
mirror of https://github.com/php/php-src.git synced 2026-04-01 21:22:13 +02:00

better fix for iconv_substr

This commit is contained in:
Stanislav Malyshev
2007-09-20 22:38:25 +00:00
parent c891118ce9
commit 39253a5418

View File

@@ -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;