projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
unistr/u8-mbtouc: Improve handling of ill-formed UTF-8 input.
[gnulib.git]
/
lib
/
unistr
/
u8-mbsnlen.c
diff --git
a/lib/unistr/u8-mbsnlen.c
b/lib/unistr/u8-mbsnlen.c
index
9ddc42e
..
f72c91c
100644
(file)
--- a/
lib/unistr/u8-mbsnlen.c
+++ b/
lib/unistr/u8-mbsnlen.c
@@
-33,7
+33,9
@@
u8_mbsnlen (const uint8_t *s, size_t n)
characters++;
if (count == -2)
break;
- if (count <= 0)
+ if (count < 0)
+ count = u8_mbtouc (&uc, s, n);
+ else if (count == 0)
count = 1;
s += count;
n -= count;