]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: fix null pointer dereference 12339/head
authoranlan_cs <vic.lan@pica8.com>
Fri, 18 Nov 2022 13:48:16 +0000 (21:48 +0800)
committeranlan_cs <vic.lan@pica8.com>
Fri, 18 Nov 2022 14:06:37 +0000 (22:06 +0800)
It is possible there is no ip address in type2 prefix, that leads to crash in
`build_evpn_type2_prefix()`.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
bgpd/bgp_evpn_vty.c

index 88c1329f48e0c342c96d2a4d3729c1861d8ae143..6350093b27aaf52ba30fc4c3a884c10de29afdb0 100644 (file)
@@ -2537,6 +2537,7 @@ static void evpn_show_route_vni_macip(struct vty *vty, struct bgp *bgp,
        safi_t safi;
        json_object *json_paths = NULL;
        struct ethaddr empty_mac = {};
+       struct ipaddr empty_ip = {};
        const struct prefix_evpn *evp;
 
        afi = AFI_L2VPN;
@@ -2550,7 +2551,8 @@ static void evpn_show_route_vni_macip(struct vty *vty, struct bgp *bgp,
                return;
        }
 
-       build_evpn_type2_prefix(&p, mac ? mac : &empty_mac, ip);
+       build_evpn_type2_prefix(&p, mac ? mac : &empty_mac,
+                               ip ? ip : &empty_ip);
 
        /* See if route exists. Look for both non-sticky and sticky. */
        dest = bgp_evpn_vni_node_lookup(vpn, &p, NULL);