From d119758b09deda047db802805b4d773ec3e8777f Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 19 Nov 2019 15:00:28 +1030 Subject: [PATCH] gossipd: don't crash if we have > 7000 stale short_channel_ids. Fixes: #3269 Signed-off-by: Rusty Russell Changelog-Fixed: gossipd crash on huge number of unknown channels. --- gossipd/seeker.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gossipd/seeker.c b/gossipd/seeker.c index 70b11cb49..e1a0cad30 100644 --- a/gossipd/seeker.c +++ b/gossipd/seeker.c @@ -358,6 +358,8 @@ static struct short_channel_id *stale_scids_remove(const tal_t *ctx, uintmap_del(&seeker->stale_scids, scid); tal_free(qf); i++; + if (i == max) + break; } tal_resize(&scids, i); tal_resize(query_flags, i);