From: Eric Biggers Date: Sun, 1 Sep 2013 00:57:01 +0000 (-0500) Subject: translate_text_to_tstr(): Correctly compare byte values X-Git-Tag: v1.5.0~11 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=c5ca51d282da984a92074acdc8977ed580e8cdd5 translate_text_to_tstr(): Correctly compare byte values --- diff --git a/programs/imagex.c b/programs/imagex.c index 4efb7a22..772b86ef 100644 --- a/programs/imagex.c +++ b/programs/imagex.c @@ -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 && - ((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