1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-26 01:18:28 +00:00

fix signed/unsigned comparison

This commit is contained in:
Pavol Rusnak 2018-10-23 17:33:49 +02:00
parent eacfa751f9
commit 5c6b472883
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 2 additions and 2 deletions

View File

@ -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;
}

View File

@ -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;