From 9784c76c9abc00630a88c42cb340ce8c81b54bba Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Thu, 24 Apr 2025 03:01:19 +0200 Subject: [PATCH] BGP: Fix crash when incoming connection for disabled protocol arrives The function bgp_find_proto() may return a protocol in DOWN state, but ao.keys (as most protocol data) are only valid in non-DOWN state. --- proto/bgp/bgp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c index dcb76e05c..f762e4a62 100644 --- a/proto/bgp/bgp.c +++ b/proto/bgp/bgp.c @@ -1702,7 +1702,7 @@ bgp_incoming_connection(sock *sk, uint dummy UNUSED) return 0; } - if (!EMPTY_LIST(p->ao.keys)) + if ((p->p.proto_state != PS_DOWN) && !EMPTY_LIST(p->ao.keys)) { int current = -1, rnext = -1; sk_get_active_ao_keys(sk, ¤t, &rnext); -- 2.47.2