From: svenhoefer Date: Wed, 21 Sep 2016 20:00:48 +0000 (+0200) Subject: - shellexec: fix unicode-range in UTF8ToUnicode ... X-Git-Url: https://git.webhop.me/?a=commitdiff_plain;h=c8557586414e5fa23bea873d19a43018912fa68e;p=shellexec.git - shellexec: fix unicode-range in UTF8ToUnicode ... 0xf8 is to much; this includes invalid 0xf7, 0xf6 and 0xf5 chars; see https://de.wikipedia.org/wiki/UTF-8#Zul.C3.A4ssige_Bytes_und_ihre_Bedeutung --- diff --git a/text.c b/text.c index 8d58e2c..49f53f8 100644 --- a/text.c +++ b/text.c @@ -22,7 +22,7 @@ int UTF8ToUnicode(char **textp, const int utf8_encoded) // returns -1 on error if (utf8_encoded && ((((unsigned char)(*text)) & 0x80) != 0)) { int remaining_unicode_length; - if ((((unsigned char)(*text)) & 0xf8) == 0xf0) + if ((((unsigned char)(*text)) & 0xf5) == 0xf0) { unicode_value = ((unsigned char)(*text)) & 0x07; remaining_unicode_length = 3; @@ -66,7 +66,7 @@ void CopyUTF8Char(char **to, char **from) int remaining_unicode_length; if (!((unsigned char)(**from) & 0x80)) remaining_unicode_length = 1; - else if ((((unsigned char)(**from)) & 0xf8) == 0xf0) + else if ((((unsigned char)(**from)) & 0xf5) == 0xf0) remaining_unicode_length = 4; else if ((((unsigned char)(**from)) & 0xf0) == 0xe0) remaining_unicode_length = 3;