Permalink
Browse files

fix signed/unsigned comparison

  • Loading branch information...
prusnak committed Oct 23, 2018
1 parent eacfa75 commit 5c6b47288323a6cafe331304d2708a3c2a45f4b0
Showing with 2 additions and 2 deletions.
  1. +1 −1 cash_addr.c
  2. +1 −1 segwit_addr.c
@@ -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;

0 comments on commit 5c6b472

Please sign in to comment.