mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-18 10:32:02 +00:00
Fix out of bounds read
b58tobin needs to check if there are more leading zeros requested by the address than there are available
This commit is contained in:
parent
009850f6c9
commit
3d7d99a3e3
7
base58.c
7
base58.c
@ -114,8 +114,13 @@ bool b58tobin(void *bin, size_t *binszp, const char *b58)
|
|||||||
binu = bin;
|
binu = bin;
|
||||||
for (i = 0; i < binsz; ++i)
|
for (i = 0; i < binsz; ++i)
|
||||||
{
|
{
|
||||||
if (binu[i])
|
if (binu[i]) {
|
||||||
|
if (zerocount > i) {
|
||||||
|
/* result too large */
|
||||||
|
return false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
--*binszp;
|
--*binszp;
|
||||||
}
|
}
|
||||||
*binszp += zerocount;
|
*binszp += zerocount;
|
||||||
|
Loading…
Reference in New Issue
Block a user