From 9f0f04769f5906a33a268aa79f1420b11c8528ac Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Mon, 18 Aug 2014 20:18:49 +0000 Subject: [PATCH] Bugfix: b58tobin: Correct zeromask for multiple-of-four binary buffer sizes --- base58.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base58.c b/base58.c index d50f582..998a802 100644 --- a/base58.c +++ b/base58.c @@ -40,7 +40,7 @@ bool b58tobin(void *bin, size_t *binszp, const char *b58, size_t b58sz) uint32_t c; size_t i, j; uint8_t bytesleft = binsz % 4; - uint32_t zeromask = ~((1 << ((bytesleft) * 8)) - 1); + uint32_t zeromask = ~((1 << ((bytesleft ?: 4) * 8)) - 1); unsigned zerocount = 0; if (!b58sz)