From 503e71d3ee4ef68fa8379b445ba7e928de19db29 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Sat, 14 Jun 2008 21:07:09 -0700 Subject: [PATCH] strfunc: fix UTF-8 mid-character limit --- strfunc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/strfunc.c b/strfunc.c index ac56ac73..5929aae5 100644 --- a/strfunc.c +++ b/strfunc.c @@ -46,7 +46,7 @@ static size_t utf8_to_16le(uint8_t *str, size_t len, char *op) if (c < 0x80) { EMIT(c); - } else if (c < 0xa0 || c >= 0xfe) { + } else if (c < 0xc0 || c >= 0xfe) { /* Invalid UTF-8 */ return -1; } else if (c < 0xe0) { @@ -110,7 +110,7 @@ static size_t utf8_to_32le(uint8_t *str, size_t len, char *op) if (c < 0x80) { EMIT(c); - } else if (c < 0xa0 || c >= 0xfe) { + } else if (c < 0xc0 || c >= 0xfe) { /* Invalid UTF-8 */ return -1; } else if (c < 0xe0) {