Skip to content

Commit

Permalink
pike: safety check for null node
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Apr 10, 2021
1 parent 912e2ef commit c9dc033
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/modules/pike/ip_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ pike_ip_node_t* mark_node(unsigned char *ip,int ip_len,
int byte_pos;

kid = pike_root->entries[ ip[0] ].node;
node = 0;
node = NULL;
byte_pos = 0;

LM_DBG("search on branch %d (top=%p)\n", ip[0],kid);
Expand All @@ -301,6 +301,10 @@ pike_ip_node_t* mark_node(unsigned char *ip,int ip_len,
}
}

if(node==NULL) {
return NULL;
}

LM_DBG("only first %d were matched!\n",byte_pos);
*flag = 0;
*father = 0;
Expand Down

0 comments on commit c9dc033

Please sign in to comment.