lib/vsprintf: print '?' for illegal Unicode sequence

Commit 0e66c10a7d ("lib: vsprintf: avoid overflow printing UTF16
strings") broke the Unicode unit tests: an illegal UTF16 code point
should be printed as '?'.

Fixes: 0e66c10a7d ("lib: vsprintf: avoid overflow printing UTF16 strings")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
Heinrich Schuchardt 2019-02-15 22:20:53 +01:00
parent d787caddf1
commit 60c4454ddb

View File

@ -288,6 +288,8 @@ static char *string16(char *buf, char *end, u16 *s, int field_width,
for (i = 0; i < len && buf + utf16_utf8_strnlen(str, 1) <= end; ++i) {
s32 s = utf16_get(&str);
if (s < 0)
s = '?';
utf8_put(s, &buf);
}
for (; len < field_width; --field_width)