]> granicus.if.org Git - php/commit
Fix #68180: iconv_mime_decode can return extra characters in a header
authorChristoph M. Becker <cmbecker69@gmx.de>
Sun, 26 Aug 2018 10:59:17 +0000 (12:59 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Sun, 26 Aug 2018 11:18:35 +0000 (13:18 +0200)
commitefb86aef12ff4f8f3908ceff2844f7511f7d61eb
tree89e408facbb0475ddb7d370ec393ba8f8cc31084
parente29c946c29afdb0bf89c5329fcf3038448d50e17
Fix #68180: iconv_mime_decode can return extra characters in a header

Basically, the algorithm to append a converted string to an existing
`smart_str` works by increasing the `smart_str` buffer, to let `iconv`
convert characters until there is no more space, to set the new length
of the `smart_str` and to repeat until there is no more input.

Formerly, the new length calculation has been wrong, though, since we
would have to take the old `out_len` into account (`buf_growth -
old_out_len - out_len`).  However, since there is no need to take the
old `out_len` into account when increasing the `smart_str` buffer, we
can simplify the fix, avoiding an additional variable.
NEWS
ext/iconv/iconv.c
ext/iconv/tests/bug68180.phpt [new file with mode: 0644]