From: Christian Franke <nob...@nowhere.ws>

extcommunity_list_set may set the ->config for an entry
to NULL. In this case, the old code in community_list_dup_check
would cause a NULL pointer dereference.

Adjust the code so it behaves the same in the absence of NULL
pointers and otherwise checks if both are NULL to determine
equality.

Signed-off-by: Christian Franke <ch...@opensourcerouting.org>
---
 bgpd/bgp_clist.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/bgpd/bgp_clist.c b/bgpd/bgp_clist.c
index bb06028..1f1a4e7 100644
--- a/bgpd/bgp_clist.c
+++ b/bgpd/bgp_clist.c
@@ -644,7 +644,10 @@ community_list_dup_check (struct community_list *list,
           break;
         case COMMUNITY_LIST_EXPANDED:
         case EXTCOMMUNITY_LIST_EXPANDED:
-          if (strcmp (entry->config, new->config) == 0)
+          if (entry->config && new->config
+              && strcmp (entry->config, new->config) == 0)
+            return 1;
+          if (!entry->config && !new->config)
             return 1;
           break;
         default:
-- 
2.8.0


_______________________________________________
Quagga-dev mailing list
Quagga-dev@lists.quagga.net
https://lists.quagga.net/mailman/listinfo/quagga-dev

Reply via email to