bolt11: mark when we decode min_final_cltv_expiry

It looks like decode_c doesn't set have_c unlike the other decode_
methods. At the start of the function, decode_c checks have_c to see if
it's set, but it is never set. It seems like this could allow for
duplicate c tags, which is probably not intended.

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin 2022-02-10 09:14:04 -08:00 committed by Rusty Russell
parent ff84b3f773
commit af16b9b9f4

View File

@ -245,7 +245,7 @@ static char *decode_x(struct bolt11 *b11,
static char *decode_c(struct bolt11 *b11,
struct hash_u5 *hu5,
u5 **data, size_t *data_len,
size_t data_length, const bool *have_c)
size_t data_length, bool *have_c)
{
u64 c;
if (*have_c)
@ -261,6 +261,7 @@ static char *decode_c(struct bolt11 *b11,
if (b11->min_final_cltv_expiry != c)
return tal_fmt(b11, "c: %"PRIu64" is too large", c);
*have_c = true;
return NULL;
}