From d76b921c269c29ec9e5f50fd4e9b3c93557dcda6 Mon Sep 17 00:00:00 2001 From: pancake Date: Tue, 26 Mar 2024 16:01:11 +0100 Subject: [PATCH] Fix #22750 - char is now unsigned on android --- libr/util/str.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libr/util/str.c b/libr/util/str.c index 6c25f58a97..9a5674e14b 100644 --- a/libr/util/str.c +++ b/libr/util/str.c @@ -1912,10 +1912,12 @@ R_API size_t r_str_ansi_nlen(const char *str, size_t slen) { } static size_t __str_ansi_sanitize_length(char const *str) { + const signed char str0 = (const signed char)str[0]; + const signed char str1 = (const signed char)str[1]; size_t i = 0; - if (str[0] == 0x1b || str[0] == 0x07 || str[0] == 0x05 || str[0] == 0x7f) { // ESC, BEL, ENQ, DEL + if (str0 == 0x1b || str0 == 0x07 || str0 == 0x05 || str0 == 0x7f) { // ESC, BEL, ENQ, DEL i++; - } else if (str[0] == -0x3e && str[1] >= -0x80 && str[1] <= -0x61) { // C1 control codes U+0080 - U+009F + } else if (str0 == -0x3e && str1 >= -0x80 && str1 <= -0x61) { // C1 control codes U+0080 - U+009F i += 2; } return i;