Browse Source

bech32: fix overflow bug.

Copied from upstream:

 2b0aac650c

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
trytravis
Rusty Russell 6 years ago
parent
commit
a1898b699d
  1. 2
      common/bech32.c

2
common/bech32.c

@ -99,7 +99,7 @@ int bech32_decode(char* hrp, uint8_t *data, size_t *data_len, const char *input,
++(*data_len); ++(*data_len);
} }
hrp_len = input_len - (1 + *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; return 0;
} }
*(data_len) -= 6; *(data_len) -= 6;

Loading…
Cancel
Save