From 6433c44dee0e5968a6c81840565f4c60ac37219d Mon Sep 17 00:00:00 2001 From: John Zaitseff Date: Thu, 15 Jun 2017 11:40:24 +1000 Subject: [PATCH] Bug fix: if "char" is unsigned (as on some architectures), b64decode() fails --- NEWS | 7 +++++++ src/utils.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index b495c4a..35cd423 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,13 @@ browse the Git repository on The ZAP Group web server at the following location: http://www.zap.org.au/gitweb/trader.git +Version 7.11 (not yet released) +------------------------------- + +Minor bug fix: some architectures treat "char" as "unsigned char", and +this caused b64decode() to fail. + + Version 7.10 (2nd June, 2017) ----------------------------- diff --git a/src/utils.c b/src/utils.c index 6d160b0..4a32fdc 100644 --- a/src/utils.c +++ b/src/utils.c @@ -873,7 +873,7 @@ ssize_t b64decode (const void *restrict in, size_t inlen, n = 1; for (size_t i = 0; i < inlen && *u_in != '\0'; i++, u_in++) { - char c = *u_in > UNSCRAMBLE_TABLE_SIZE ? + signed char c = *u_in > UNSCRAMBLE_TABLE_SIZE ? UNSCRAMBLE_INVALID : unscramble_table[*u_in]; switch (c) {