From 7a68370285ed4d64e1ed9dcab60b17bfb26a0ba4 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Thu, 5 Nov 2020 22:00:39 +0200 Subject: [PATCH] bgpd: Check if peer is not NULL before calling peer_as_change() Prevents NULL possible dereference. Signed-off-by: Donatas Abraitis --- bgpd/bgp_nb_config.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_nb_config.c b/bgpd/bgp_nb_config.c index eca7093fcd..8eaedf4e0e 100644 --- a/bgpd/bgp_nb_config.c +++ b/bgpd/bgp_nb_config.c @@ -5214,7 +5214,8 @@ int bgp_neighbors_unnumbered_neighbor_neighbor_remote_as_remote_as_type_destroy( peer = peer_lookup_by_conf_if(bgp, peer_str); /* remote-as set to 0 and as_type to unspecified */ - peer_as_change(peer, 0, AS_UNSPECIFIED); + if (peer) + peer_as_change(peer, 0, AS_UNSPECIFIED); break; } -- 2.39.5