]> wimlib.net Git - wimlib/commitdiff
translate_text_to_tstr(): Correctly compare byte values
authorEric Biggers <ebiggers3@gmail.com>
Sun, 1 Sep 2013 00:57:01 +0000 (19:57 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Sun, 1 Sep 2013 00:57:01 +0000 (19:57 -0500)
programs/imagex.c

index 4efb7a22d525efb78e28f6a08a1b185d72222692..772b86ef75463092cd8aa67eeac55c337bb019ef 100644 (file)
@@ -937,8 +937,8 @@ translate_text_to_tstr(char *text, size_t num_bytes, size_t *num_tchars_ret)
        size_t num_wchars;
 
        if (num_bytes >= 2 &&
        size_t num_wchars;
 
        if (num_bytes >= 2 &&
-           ((text[0] == 0xff && text[1] == 0xfe) ||
-            (text[0] <= 0x7f && text[1] == 0x00)))
+           (((unsigned char)text[0] == 0xff && (unsigned char)text[1] == 0xfe) ||
+            ((unsigned char)text[0] <= 0x7f && (unsigned char)text[1] == 0x00)))
        {
                /* File begins with 0xfeff, the BOM for UTF-16LE, or it begins
                 * with something that looks like an ASCII character encoded as
        {
                /* File begins with 0xfeff, the BOM for UTF-16LE, or it begins
                 * with something that looks like an ASCII character encoded as