From f7b60a3a1fd91846e8f4096073d8e57cb4cf3d8f Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Mon, 28 Nov 2022 10:31:58 +0100 Subject: [PATCH] bgpd: fix dereference of null pointer in 'bgp_evpn_es_evi_show_entry' The bgp_evpn_es_evi_show_entry() function tries to access the vni attribute, while the vpn structure may be null. Signed-off-by: Philippe Guibert --- bgpd/bgp_evpn_mh.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_evpn_mh.c b/bgpd/bgp_evpn_mh.c index dd40a072f9..29a4058ded 100644 --- a/bgpd/bgp_evpn_mh.c +++ b/bgpd/bgp_evpn_mh.c @@ -3966,7 +3966,8 @@ static void bgp_evpn_es_evi_show_entry(struct vty *vty, json_object *json_types; json_object_string_add(json, "esi", es_evi->es->esi_str); - json_object_int_add(json, "vni", es_evi->vpn->vni); + if (es_evi->vpn) + json_object_int_add(json, "vni", es_evi->vpn->vni); if (es_evi->flags & (BGP_EVPNES_EVI_LOCAL | BGP_EVPNES_EVI_REMOTE)) {