aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Kabaev <kan@FreeBSD.org>2015-06-13 15:14:39 +0000
committerAlexander Kabaev <kan@FreeBSD.org>2015-06-13 15:14:39 +0000
commitdbf26257f1283ef73eb1e9fe29ba69df0bfc589d (patch)
tree12e7e304779718467323c68c3296846c29a132ca
parent619ba3b41634db404b3699bf677285350ddf00a0 (diff)
downloadsrc-dbf26257f1283ef73eb1e9fe29ba69df0bfc589d.tar.gz
src-dbf26257f1283ef73eb1e9fe29ba69df0bfc589d.zip
Unbreak libxo's handling of characters not representable in current locale
The xo_format_string_direct function loops forever never advancing the processed string pointer when it encounters a character that makes mbrtowc fail. Make it emit '?' character instead, as it seems this is what the code intent was, sans bugs. Differential Revision: https://reviews.freebsd.org/D2802 Reviewed by: marcel
Notes
Notes: svn path=/head/; revision=284340
-rw-r--r--contrib/libxo/libxo/libxo.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/contrib/libxo/libxo/libxo.c b/contrib/libxo/libxo/libxo.c
index 4fd18fd01bb4..bb4ce2e7e8af 100644
--- a/contrib/libxo/libxo/libxo.c
+++ b/contrib/libxo/libxo/libxo.c
@@ -2077,7 +2077,8 @@ xo_format_string_direct (xo_handle_t *xop, xo_buffer_t *xbp,
ilen = mbrtowc(&wc, cp, ilen, &xop->xo_mbstate);
if (ilen < 0) { /* Invalid data; skip */
xo_failure(xop, "invalid mbs char: %02hhx", *cp);
- continue;
+ wc = L'?';
+ ilen = 1;
}
if (ilen == 0) { /* Hit a wide NUL character */
len = 0;