]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: fix some NULL pointer dereference bugs
authorRenato Westphal <renato@opensourcerouting.org>
Fri, 19 Oct 2018 18:54:26 +0000 (15:54 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Mon, 17 Dec 2018 14:14:05 +0000 (12:14 -0200)
Other parts of the rfapi code also check if these pointers are NULL or
not before using them.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
bgpd/rfapi/bgp_rfapi_cfg.c

index 8553846c9025137bbf0b5a0db3f14b6cf60f522c..b5879df70010556f7bc9f73257484db0838fc46f 100644 (file)
@@ -1601,8 +1601,10 @@ DEFUN (vnc_nve_group_export_no_prefixlist,
        idx += 2; /* skip afi and keyword */
 
        if (is_bgp) {
-               if (idx == argc || strmatch(argv[idx]->arg,
-                                           rfg->plist_export_bgp_name[afi])) {
+               if (idx == argc
+                   || (rfg->plist_export_bgp_name[afi]
+                       && strmatch(argv[idx]->arg,
+                                   rfg->plist_export_bgp_name[afi]))) {
                        if (rfg->plist_export_bgp_name[afi])
                                free(rfg->plist_export_bgp_name[afi]);
                        rfg->plist_export_bgp_name[afi] = NULL;
@@ -1612,8 +1614,9 @@ DEFUN (vnc_nve_group_export_no_prefixlist,
                }
        } else {
                if (idx == argc
-                   || strmatch(argv[idx]->arg,
-                               rfg->plist_export_zebra_name[afi])) {
+                   || (rfg->plist_export_zebra_name[afi]
+                       && strmatch(argv[idx]->arg,
+                                   rfg->plist_export_zebra_name[afi]))) {
                        if (rfg->plist_export_zebra_name[afi])
                                free(rfg->plist_export_zebra_name[afi]);
                        rfg->plist_export_zebra_name[afi] = NULL;
@@ -1732,8 +1735,10 @@ DEFUN (vnc_nve_group_export_no_routemap,
        }
 
        if (is_bgp) {
-               if (idx == argc || strmatch(argv[idx]->arg,
-                                           rfg->routemap_export_bgp_name)) {
+               if (idx == argc
+                   || (rfg->routemap_export_bgp_name
+                       && strmatch(argv[idx]->arg,
+                                   rfg->routemap_export_bgp_name))) {
                        if (rfg->routemap_export_bgp_name)
                                free(rfg->routemap_export_bgp_name);
                        rfg->routemap_export_bgp_name = NULL;
@@ -1743,8 +1748,10 @@ DEFUN (vnc_nve_group_export_no_routemap,
                        vnc_direct_bgp_reexport_group_afi(bgp, rfg, AFI_IP6);
                }
        } else {
-               if (idx == argc || strmatch(argv[idx]->arg,
-                                           rfg->routemap_export_zebra_name)) {
+               if (idx == argc
+                   || (rfg->routemap_export_zebra_name
+                       && strmatch(argv[idx]->arg,
+                                   rfg->routemap_export_zebra_name))) {
                        if (rfg->routemap_export_zebra_name)
                                free(rfg->routemap_export_zebra_name);
                        rfg->routemap_export_zebra_name = NULL;