]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Ensure we don't dereference a non-valid pointer
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 22 May 2018 14:44:32 +0000 (10:44 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 22 May 2018 14:44:32 +0000 (10:44 -0400)
The attr->ecommunity may be null coming into the function
at this point.  Ensure that it is.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd/bgp_evpn.c

index 8394c3a7b7dcb62b9d51c1fe7c195a89e0b4ca62..023fef3deabe26974cb937c541a3db67d1161c21 100644 (file)
@@ -771,8 +771,11 @@ static void add_mac_mobility_to_attr(uint32_t seq_num, struct attr *attr)
                ecom_tmp.size = 1;
                ecom_tmp.val = (uint8_t *)eval.val;
 
-               attr->ecommunity =
-                       ecommunity_merge(attr->ecommunity, &ecom_tmp);
+               if (attr->ecommunity)
+                       attr->ecommunity =
+                               ecommunity_merge(attr->ecommunity, &ecom_tmp);
+               else
+                       attr->ecommunity = ecommunity_dup(&ecom_tmp);
        }
 }