From e80bc08944be7cbe4085c03653818139ccd616d1 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Mon, 4 Jan 2021 07:56:47 -0500 Subject: [PATCH] bgpd: Prevent null deref There exists a path where we could possibly have a NULL deref of a pointer. Prevent this from happening. Signed-off-by: Donald Sharp --- bgpd/bgp_nb_config.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_nb_config.c b/bgpd/bgp_nb_config.c index 6ee8b25b82..ec3b0c13a1 100644 --- a/bgpd/bgp_nb_config.c +++ b/bgpd/bgp_nb_config.c @@ -6292,7 +6292,11 @@ static struct peer *bgp_peer_group_peer_lookup(struct bgp *bgp, struct peer_group *group = NULL; group = peer_group_lookup(bgp, peer_str); - return group->conf; + + if (group) + return group->conf; + + return NULL; } /* -- 2.39.5