304a9d2db2669ad910577e00dce2f81bfd0d5d39 |
|
01-Jun-2015 |
Phil Carmody <phil@dovecot.fi> |
lib: API change - have uni_utf8_get_char*() return _char_bytes
Often the two functions are called in close proximity (both ways round). As
_get_char*() calls _char_bytes() early on the success path, we may as well
return that value to the caller for immediate use.
The callers which call _char_bytes() first are simply rejecting the truncated
case quickly - all other invalid cases still call both functions, and all
other valid cases (which should be the fast path) likewise call both.
Signed-off-by: Phil Carmody <phil@dovecot.fi> |
32ae620015da6ab2ec28e04d3cdcdb4420f1fa6b |
|
15-Jan-2015 |
Timo Sirainen <tss@iki.fi> |
lib: Fixed NUL-handling in uni_utf8_*strlen*()
uni_utf8_strlen() could have skipped over the ending NUL byte and caused
read buffer overflows with invalid input.
uni_utf8_strlen_n() and uni_utf8_partial_strlen_n() now allow NUL bytes in
the input and they're treated as regular control characters. Previously the
size was actually treated as max_size with early NUL byte termination.
Technically this is an API change, but I'm not aware of anything using these
functions in an incompatible way. |