mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-27 00:28:10 +00:00
fix signed/unsigned comparison
This commit is contained in:
parent
eacfa751f9
commit
5c6b472883
@ -101,7 +101,7 @@ int cash_decode(char* hrp, uint8_t *data, size_t *data_len, const char *input) {
|
||||
++(*data_len);
|
||||
}
|
||||
hrp_len = input_len - (1 + *data_len);
|
||||
if (hrp_len < 1 || hrp_len > MAX_HRP_SIZE ||
|
||||
if (1 + *data_len >= input_len || hrp_len > MAX_HRP_SIZE ||
|
||||
*data_len < CHECKSUM_SIZE || *data_len > CHECKSUM_SIZE + MAX_BASE32_SIZE) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ int bech32_decode(char* hrp, uint8_t *data, size_t *data_len, const char *input)
|
||||
++(*data_len);
|
||||
}
|
||||
hrp_len = input_len - (1 + *data_len);
|
||||
if (hrp_len < 1 || *data_len < 6) {
|
||||
if (1 + *data_len >= input_len || *data_len < 6) {
|
||||
return 0;
|
||||
}
|
||||
*(data_len) -= 6;
|
||||
|
Loading…
Reference in New Issue
Block a user