Browse code

pike: safety check for null node

(cherry picked from commit c9dc0336a33a0ecfe776975be7fbfab8f3c91b48)

Daniel-Constantin Mierla authored on 10/04/2021 09:21:09
Showing 1 changed files
... ...
@@ -285,7 +285,7 @@ pike_ip_node_t* mark_node(unsigned char *ip,int ip_len,
285 285
 	int    byte_pos;
286 286
 
287 287
 	kid = pike_root->entries[ ip[0] ].node;
288
-	node = 0;
288
+	node = NULL;
289 289
 	byte_pos = 0;
290 290
 
291 291
 	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,
301 301
 		}
302 302
 	}
303 303
 
304
+	if(node==NULL) {
305
+		return NULL;
306
+	}
307
+
304 308
 	LM_DBG("only first %d were matched!\n",byte_pos);
305 309
 	*flag = 0;
306 310
 	*father = 0;