]> git.ozlabs.org Git - ccan/commitdiff
base64: really fix.
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 1 Aug 2023 20:27:30 +0000 (05:57 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 24 Jun 2024 02:46:26 +0000 (12:16 +0930)
Playing games with chars is always a bad idea, but this time for sure!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/base64/base64.c

index c28e0da2a496dcbdd09abf7688caf5bbc37e117d..89e0d38b462106c668dd43cfd1266bc69e9dec3a 100644 (file)
@@ -31,7 +31,7 @@ static int8_t sixbit_from_b64(const base64_maps_t *maps,
        int8_t ret;
 
        ret = maps->decode_map[(unsigned char)b64letter];
-       if (ret == '\xff') {
+       if (ret == (int8_t)'\xff') {
                errno = EDOM;
                return -1;
        }
@@ -41,7 +41,7 @@ static int8_t sixbit_from_b64(const base64_maps_t *maps,
 
 bool base64_char_in_alphabet(const base64_maps_t *maps, const char b64char)
 {
-       return (maps->decode_map[(const unsigned char)b64char] != '\xff');
+       return (maps->decode_map[(const unsigned char)b64char] != (signed char)'\xff');
 }
 
 void base64_init_maps(base64_maps_t *dest, const char src[64])