]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r283406,283418:
authortijl <tijl@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Tue, 2 Jun 2015 09:42:00 +0000 (09:42 +0000)
committertijl <tijl@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Tue, 2 Jun 2015 09:42:00 +0000 (09:42 +0000)
commit58ac0a245097402f7327aeb4b5e395c96b46951a
tree39abd60b445dbaaba906a89e4890cff4bf3dab45
parent268e1299b1600845c4c8dfaf726494a6ffc4ab10
MFC r283406,283418:

Fix decoding of UTF-7 when a base64 encoded chunk appears at the end of
the input buffer.

_citrus_UTF7_mbtoutf16 stored the decoder state at the beginning so it
could restore this state on an incomplete character such that the next
call would restart the decoding.  The problem was that "-" (end of base64
mode) at the end of a string was also treated as an incomplete character
but was also removed from the state buffer.  So the initial state would be
restored (with base64 mode) and the next call would no longer see the "-"
so it continued in base64 mode.

This state saving/restoring isn't needed here.  It's already handled
elsewhere (citrus_iconv_std.c:_citrus_iconv_std_iconv_convert) so just
remove it.

Also initialise *nresult.

When only 2 bytes can be read from a 4 byte UTF-16 character in a base64
encoded chunk of a UTF-7 string, treat that as an incomplete character and
return an error instead of a shift sequence and no error.

Also check that the low 2 bytes have a valid value.

PR: 200398

git-svn-id: svn://svn.freebsd.org/base/stable/10@283908 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
lib/libiconv_modules/UTF7/citrus_utf7.c