php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #68180
Patch iconv-appendl-length revision 2014-10-07 22:03 UTC by chad at mailchimp dot com

Patch iconv-appendl-length for ICONV related Bug #68180

Patch version 2014-10-07 22:03 UTC

Return to Bug #68180 | Download this patch
Patch Revisions:

Developer: chad@mailchimp.com

diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index 2df759f..8d1e3ab 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -455,12 +455,12 @@ static php_iconv_err_t _php_iconv_appendl(smart_str *d, const char *s, size_t l,
 
        if (in_p != NULL) {
                while (in_left > 0) {
-                       out_left = buf_growth - out_left;
                        {
                                size_t newlen;
-                               smart_str_alloc((d), out_left, 0);
+                               smart_str_alloc((d), buf_growth - out_left, 0);
                        }
 
+                       out_left = buf_growth;
                        out_p = (d)->c + (d)->len;
 
                        if (iconv(cd, (char **)&in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 01:01:30 2024 UTC