Skip to content

Commit

Permalink
fix signed/unsigned comparison
Browse files Browse the repository at this point in the history
  • 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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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.