mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
pubkey: valgrind was reporting about unset memory in address parsing
This is likely due to `libbase58` implicitly relying on the passed in buffer to be memset to 0, in order to report the correct decoded length.
This commit is contained in:
parent
954b2c4a67
commit
f10b779c83
@ -53,12 +53,14 @@ static bool from_base58(u8 *version,
|
||||
const char *base58, size_t base58_len)
|
||||
{
|
||||
u8 buf[1 + sizeof(*rmd) + 4];
|
||||
|
||||
/* Avoid memcheck complaining if decoding resulted in a short value */
|
||||
memset(buf, 0, sizeof(buf));
|
||||
b58_sha256_impl = my_sha256;
|
||||
|
||||
size_t buflen = sizeof(buf);
|
||||
b58tobin(buf, &buflen, base58, base58_len);
|
||||
int r = b58check(buf, sizeof(buf), base58, base58_len);
|
||||
|
||||
int r = b58check(buf, buflen, base58, base58_len);
|
||||
*version = buf[0];
|
||||
memcpy(rmd, buf + 1, sizeof(*rmd));
|
||||
return r >= 0;
|
||||
|
Loading…
Reference in New Issue
Block a user