Skip to content

Commit

Permalink
bgpd: null check (Coverity 1472237)
Browse files Browse the repository at this point in the history
Signed-off-by: F. Aragon <paco@voltanet.io>
  • Loading branch information
F. Aragon committed Aug 3, 2018
1 parent 25f5f03 commit 9f134cd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bgpd/bgp_table.c
Expand Up @@ -144,9 +144,6 @@ void bgp_table_range_lookup(const struct bgp_table *table, struct prefix *p,
struct bgp_node *node = bgp_node_from_rnode(table->route_table->top);
struct bgp_node *matched = NULL;

if (node == NULL)
return;

while (node && node->p.prefixlen <= p->prefixlen
&& prefix_match(&node->p, p)) {
if (node->info && node->p.prefixlen == p->prefixlen) {
Expand All @@ -157,6 +154,9 @@ void bgp_table_range_lookup(const struct bgp_table *table, struct prefix *p,
&p->u.prefix, node->p.prefixlen)]);
}

if (node == NULL)
return;

if ((matched == NULL && node->p.prefixlen > maxlen) || !node->parent)
return;
else if (matched == NULL)
Expand Down

0 comments on commit 9f134cd

Please sign in to comment.