From c9d24bcfd5c2f9940f1731f2747094951dbd1968 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin <bapt@FreeBSD.org> Date: Sat, 8 Aug 2015 23:59:15 +0000 Subject: [PATCH] Remove 5 and 6 bytes sequences which are illegal in UTF-8 space. Per rfc3629 value greater than 0x10ffff should be rejected Suggested by: jilles --- lib/libc/locale/utf8.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lib/libc/locale/utf8.c b/lib/libc/locale/utf8.c index ce49279cb2d7..843d59f77c54 100644 --- a/lib/libc/locale/utf8.c +++ b/lib/libc/locale/utf8.c @@ -145,14 +145,6 @@ _UTF8_mbrtowc(wchar_t * __restrict pwc, const char * __restrict s, size_t n, mask = 0x07; want = 4; lbound = 0x10000; - } else if ((ch & 0xfc) == 0xf8) { - mask = 0x03; - want = 5; - lbound = 0x200000; - } else if ((ch & 0xfe) == 0xfc) { - mask = 0x01; - want = 6; - lbound = 0x4000000; } else { /* * Malformed input; input is not UTF-8.