Skip to content

Commit a1898b6

Browse files
committed
bech32: fix overflow bug.
Copied from upstream: sipa/bech32@2b0aac6 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 1935614 commit a1898b6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

common/bech32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ int bech32_decode(char* hrp, uint8_t *data, size_t *data_len, const char *input,
9999
++(*data_len);
100100
}
101101
hrp_len = input_len - (1 + *data_len);
102-
if (hrp_len < 1 || *data_len < 6) {
102+
if (1 + *data_len >= input_len || *data_len < 6) {
103103
return 0;
104104
}
105105
*(data_len) -= 6;

0 commit comments

Comments
 (0)