Skip to content
This repository has been archived by the owner on Nov 16, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
fix signed/unsigned comparison
  • Loading branch information
prusnak committed Oct 23, 2018
1 parent eacfa75 commit 5c6b472
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cash_addr.c
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion segwit_addr.c
Expand Up @@ -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;
Expand Down

0 comments on commit 5c6b472

Please sign in to comment.