From 5f2072869a04c7fbac72dffd9e1e240bbc9e2ac3 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Thu, 27 Jul 2023 11:36:24 +0200 Subject: [PATCH] pay: Fix a null-dereference introduced in #6428 The alias may not be set for non-alias channels after they confirm. The other branch is safe because we only consider active channels. Changelog-None Fixes #6450 --- plugins/libplugin-pay.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/libplugin-pay.c b/plugins/libplugin-pay.c index a750a12f9..9f75a4ad4 100644 --- a/plugins/libplugin-pay.c +++ b/plugins/libplugin-pay.c @@ -2405,10 +2405,12 @@ local_channel_hints_listpeerchannels(struct command *cmd, const char *buffer, channel_hints_update( p, *chans[i]->scid, chans[i]->direction, enabled, true, &chans[i]->spendable_msat, &htlc_budget); - channel_hints_update(p, *chans[i]->alias[LOCAL], - chans[i]->direction, - false /* not enabled */, true, - &AMOUNT_MSAT(0), &htlc_budget); + if (chans[i]->alias[LOCAL] != NULL) + channel_hints_update(p, *chans[i]->alias[LOCAL], + chans[i]->direction, + false /* not enabled */, + true, &AMOUNT_MSAT(0), + &htlc_budget); } else { channel_hints_update(p, *chans[i]->alias[LOCAL], chans[i]->direction, enabled, true,