Skip to content

Commit

Permalink
bech32: fix overflow bug.
Browse files Browse the repository at this point in the history
Copied from upstream:

 sipa/bech32@2b0aac6

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Nov 2, 2018
1 parent 1935614 commit a1898b6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion common/bech32.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,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 a1898b6

Please sign in to comment.