b58check: Check binsz is long enough for checksum

This commit is contained in:
Luke Dashjr
2014-08-18 14:51:58 +00:00
parent 58d0e9a7ab
commit 88761e9e2c

View File

@@ -102,6 +102,8 @@ int b58check(const void *bin, size_t binsz, const char *base58str, size_t b58sz)
unsigned char buf[32];
const uint8_t *binc = bin;
unsigned i;
if (binsz < 4)
return -4;
if (!my_dblsha256(buf, bin, binsz - 4))
return -2;
if (memcmp(&binc[binsz - 4], buf, 4))