From 02f9c2df249c342a282e47179e643471cdf9cd77 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Wed, 23 Nov 2022 13:42:41 +0100 Subject: [PATCH] autoclean: Fix a null-pointer derefence when checking HTLC age The autoclean plugin would assume we have a `resolved_time` which may not be true for oldish nodes that predate our annotations. Changelog-None Unreleased change Reported-by: <@devastgh> --- plugins/autoclean.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/autoclean.c b/plugins/autoclean.c index 81e50352a..1b2d51eb1 100644 --- a/plugins/autoclean.c +++ b/plugins/autoclean.c @@ -324,6 +324,14 @@ static struct command_result *listforwards_done(struct command *cmd, continue; } + /* Check if we have a resolved_time, before making a + * decision on it. This is possible in older nodes + * that predate our annotations for forwards.*/ + if (json_get_member(buf, t, "resolved_time") == NULL) { + cinfo->num_uncleaned++; + continue; + } + time = *json_get_member(buf, t, "resolved_time"); /* This is a float, so truncate at '.' */ for (int off = time.start; off < time.end; off++) {