]> git.proxmox.com Git - mirror_frr.git/commitdiff
pimd: fix pim_instance NULL deference in zclient_lookup_read_pipe
authorsarita patra <saritap@vmware.com>
Mon, 4 Apr 2022 10:55:23 +0000 (03:55 -0700)
committersarita patra <saritap@vmware.com>
Mon, 4 Apr 2022 12:27:59 +0000 (05:27 -0700)
Fixing the below coverity issue.
>>>     CID 1515546:  Null pointer dereferences  (NULL_RETURNS)
>>>     Dereferencing a pointer that might be "NULL" "pim" when calling "zclient_lookup_nexthop_once".
391             zclient_lookup_nexthop_once(pim, nexthop_tab, 10, l);

Signed-off-by: sarita patra <saritap@vmware.com>
pimd/pim_zlookup.c

index c487f995e72f280fe47218b86598fb558f2e0129..5d99f131a8fe98fe067da98dd57beb3b141fbdfb 100644 (file)
@@ -388,6 +388,12 @@ void zclient_lookup_read_pipe(struct thread *thread)
        struct pim_zlookup_nexthop nexthop_tab[10];
        struct in_addr l = {.s_addr = INADDR_ANY};
 
+       if (!pim) {
+               if (PIM_DEBUG_PIM_NHT_DETAIL)
+                       zlog_debug("%s: Unable to find pim instance", __func__);
+               return;
+       }
+
        zclient_lookup_nexthop_once(pim, nexthop_tab, 10, l);
        thread_add_timer(router->master, zclient_lookup_read_pipe, zlookup, 60,
                         &zlookup_read);