From 2eeec53674b4c47c5ad13d2ef45416569679c32e Mon Sep 17 00:00:00 2001 From: Storm Knight Date: Sat, 28 Mar 2026 11:17:56 -0400 Subject: [PATCH] lightningd/peer_control: initialize error pointer in handle_peer_spoke The local variable `error` in handle_peer_spoke() is declared as a pointer type with no initialization. Several error paths jump to the `send_error` label where `error` is dereferenced (passed to tal_hex() and towire_connectd_peer_send_msg()). While sockpair() currently sets the `error` pointer via the output parameter on failure, the declaration should be initialized to NULL as a defensive measure and to avoid undefined behavior if code paths change. Fixes #8849 --- lightningd/peer_control.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index ddcdb27e9dcf..2d5cf8ea1c17 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -1993,7 +1993,7 @@ void handle_peer_spoke(struct lightningd *ld, const u8 *msg) struct channel_id channel_id; struct peer *peer; bool dual_fund; - const u8 *error; + const u8 *error = NULL; int other_fd; struct peer_fd *pfd; char *errmsg;