]> granicus.if.org Git - php/commitdiff
MFH: Fixed bug #33268 (iconv_strlen() works only with a parameter of < 3
authorIlia Alshanetsky <iliaa@php.net>
Wed, 8 Jun 2005 23:51:05 +0000 (23:51 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 8 Jun 2005 23:51:05 +0000 (23:51 +0000)
in length).

NEWS
ext/iconv/iconv.c

diff --git a/NEWS b/NEWS
index ac181cd0960b8a1410ae9749424ee9d280d82ae9..7a5ebc3b0e871c3d38b066279adcbb09ba6d8d23 100644 (file)
--- 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)
index b8c76c5bedd10656bcd4ce8c140fde57826264d1..7020ff00eff6bd13fbdc4f3967c11e07650e8776 100644 (file)
@@ -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;