]> git.webhop.me Git - shellexec.git/commitdiff
- shellexec: fix unicode-range in UTF8ToUnicode ...
authorsvenhoefer <svenhoefer@svenhoefer.com>
Wed, 21 Sep 2016 20:00:48 +0000 (22:00 +0200)
committersvenhoefer <svenhoefer@svenhoefer.com>
Wed, 21 Sep 2016 20:00:48 +0000 (22:00 +0200)
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

text.c

diff --git a/text.c b/text.c
index 8d58e2cfc3438d30f03b9e61250d69cdce997760..49f53f8d444f6e4875a86d2dbac3602690b783bd 100644 (file)
--- 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;