1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 20:38:10 +00:00

fix(core): prevent negative-length array

[no changelog]
This commit is contained in:
Ondřej Vejpustek 2024-04-08 16:50:28 +02:00
parent b1c670090a
commit 548e329f9d

View File

@ -45,6 +45,10 @@ STATIC mp_obj_t mod_trezorcrypto_bech32_decode(size_t n_args,
mp_raise_ValueError(NULL);
}
if (bech.len < 8) {
mp_raise_ValueError(NULL);
}
uint8_t data[bech.len - 8];
char hrp[BECH32_MAX_HRP_LEN + 1] = {0};
size_t data_len = 0;