From 2ffc213bf847dd925483761a074accac2f9b35ba Mon Sep 17 00:00:00 2001 From: "F. Aragon" Date: Mon, 2 Jul 2018 17:44:58 +0200 Subject: [PATCH] ospfd pimd: null check (PVS-Studio) Signed-off-by: F. Aragon --- ospfd/ospf_ase.c | 7 ++++++- pimd/pim_mroute.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ospfd/ospf_ase.c b/ospfd/ospf_ase.c index c799a4b30f..d84fd26ac4 100644 --- a/ospfd/ospf_ase.c +++ b/ospfd/ospf_ase.c @@ -543,7 +543,7 @@ static int ospf_ase_route_match_same(struct route_table *rt, struct ospf_route *newor) { struct route_node *rn; - struct ospf_route * or ; + struct ospf_route *or; struct ospf_path *op; struct ospf_path *newop; struct listnode *n1; @@ -559,6 +559,9 @@ static int ospf_ase_route_match_same(struct route_table *rt, route_unlock_node(rn); or = rn->info; + + assert(or); + if (or->path_type != newor->path_type) return 0; @@ -577,6 +580,8 @@ static int ospf_ase_route_match_same(struct route_table *rt, return 0; } + assert(or->paths); + if (or->paths->count != newor->paths->count) return 0; diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c index c7e1a18d28..dd30678405 100644 --- a/pimd/pim_mroute.c +++ b/pimd/pim_mroute.c @@ -158,7 +158,7 @@ static int pim_mroute_msg_nocache(int fd, struct interface *ifp, * the Interface type is SSM we don't need to * do anything here */ - if ((pim_rpf_addr_is_inaddr_none(rpg)) || (!pim_ifp) + if (!rpg || (pim_rpf_addr_is_inaddr_none(rpg)) || (!(PIM_I_am_DR(pim_ifp)))) { if (PIM_DEBUG_MROUTE_DETAIL) zlog_debug( -- 2.39.5