From 2edd17ab54a63ea6d624f9d7162be1507968bd8e Mon Sep 17 00:00:00 2001 From: Saleem Rashid Date: Mon, 29 May 2017 09:49:38 +0100 Subject: [PATCH] base32: Handle when char is unsigned --- base32.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/base32.c b/base32.c index 42675e5b5..06760ccae 100644 --- a/base32.c +++ b/base32.c @@ -42,8 +42,12 @@ char *base32_encode(const uint8_t *in, size_t inlen, char *out, size_t outlen, c base32_encode_unsafe(in, inlen, (uint8_t *) out); for (size_t i = 0; i < length; i++) { - if ((out[i] = base32_encode_character(out[i], alphabet)) == -1) { - return NULL; + int ret = base32_encode_character(out[i], alphabet); + + if (ret == -1) { + return false; + } else { + out[i] = ret; } }