]> xenbits.xensource.com Git - xtf.git/commitdiff
libc: Fix strcmp() ABI violations
authorAndrew Cooper <andrew.cooper3@citrix.com>
Sat, 11 May 2019 18:20:34 +0000 (19:20 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Sat, 11 May 2019 18:20:34 +0000 (19:20 +0100)
The C standard specifies that strcmp() interprets the provided strings as
unsigned char, rather than signed.  This affects the result when used on
strings with the high bit set.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
common/libc/string.c

index 967f2fab4b1995cce129ad1d623a49ace6c204ed..5c25e2728971f63bd8712aed9d4ebdba4315af9c 100644 (file)
@@ -46,7 +46,7 @@ char *(strncpy)(char *dst, const char *src, size_t n)
 
 int (strcmp)(const char *_s1, const char *_s2)
 {
-    char s1, s2;
+    unsigned char s1, s2;
 
     do {
         s1 = *_s1++;