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

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;