summaryrefslogtreecommitdiff
path: root/ext/iconv/iconv.c
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2018-09-22 15:43:06 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2018-09-22 15:56:49 +0200
commit150e2b8c8c7a6d4a80df6a4748bb4a521e98b3e8 (patch)
treeacd02dbd917431f314ce6bc4e8026e04ce190b55 /ext/iconv/iconv.c
parent9f3aac9e390343d0058e5aedcc7e621cd44ed2b5 (diff)
parent7c2cc9aa56efb3f990967aee2fc0569df19a4d50 (diff)
downloadphp-git-150e2b8c8c7a6d4a80df6a4748bb4a521e98b3e8.tar.gz
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fix #66828: iconv_mime_encode Q-encoding longer than it should be
Diffstat (limited to 'ext/iconv/iconv.c')
-rw-r--r--ext/iconv/iconv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index d1b28c122d..bd21ede5ac 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -1357,7 +1357,7 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn
prev_in_left = ini_in_left = in_left;
ini_in_p = in_p;
- for (out_size = (char_cnt - 2) / 3; out_size > 0;) {
+ for (out_size = (char_cnt - 2); out_size > 0;) {
#if !ICONV_SUPPORTS_ERRNO
size_t prev_out_left;
#endif
@@ -1421,7 +1421,7 @@ static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fn
break;
}
- out_size -= ((nbytes_required - (char_cnt - 2)) + 1) / 3;
+ out_size -= ((nbytes_required - (char_cnt - 2)) + 2) / 3;
in_left = ini_in_left;
in_p = ini_in_p;
}