From: Ilia Alshanetsky Date: Wed, 8 Jun 2005 23:51:05 +0000 (+0000) Subject: MFH: Fixed bug #33268 (iconv_strlen() works only with a parameter of < 3 X-Git-Tag: php-5.0.5RC1~176 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=931158fde13d1c9b45b6ca12b6f3b5c63aa1facf;p=php MFH: Fixed bug #33268 (iconv_strlen() works only with a parameter of < 3 in length). --- diff --git a/NEWS b/NEWS index ac181cd096..7a5ebc3b0e 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,8 @@ PHP NEWS - Fixed memory corruption in ImageTTFText() with 64bit systems. (Andrey) - Fixed memory corruption in stristr(). (Derick) - Fixed segfaults when CURL callback functions throw exception. (Tony) +- Fixed bug #33268 (iconv_strlen() works only with a parameter of < 3 in + length). (Ilia) - Fixed bug #33243 (ze1_compatibility_mode does not work as expected). (Dmitry) - Fixed bug #33242 (Mangled error message when stream fails). (Derick) - Fixed bug #33222 (segfault when CURL handle is closed in a callback). (Tony) diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index b8c76c5bed..7020ff00ef 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -516,7 +516,7 @@ static php_iconv_err_t _php_iconv_strlen(unsigned int *pretval, const char *str, #endif } - out_left = 0; + errno = out_left = 0; for (in_p = str, in_left = nbytes, cnt = 0; in_left > 0; cnt+=2) { size_t prev_in_left; @@ -547,6 +547,7 @@ static php_iconv_err_t _php_iconv_strlen(unsigned int *pretval, const char *str, break; case E2BIG: + case 0: *pretval = cnt; break;