pike: safety check for null node
authorDaniel-Constantin Mierla <miconda@gmail.com>
Sat, 10 Apr 2021 09:21:09 +0000 (11:21 +0200)
committerDaniel-Constantin Mierla <miconda@gmail.com>
Tue, 13 Apr 2021 06:32:28 +0000 (08:32 +0200)
(cherry picked from commit c9dc0336a33a0ecfe776975be7fbfab8f3c91b48)

src/modules/pike/ip_tree.c

index e8b93b8..c0324c0 100644 (file)
@@ -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);
@@ -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;