[sr-dev] git:master:c9dc0336: pike: safety check for null node

Daniel-Constantin Mierla miconda at gmail.com
Sat Apr 10 11:21:41 CEST 2021


Module: kamailio
Branch: master
Commit: c9dc0336a33a0ecfe776975be7fbfab8f3c91b48
URL: https://github.com/kamailio/kamailio/commit/c9dc0336a33a0ecfe776975be7fbfab8f3c91b48

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-04-10T11:21:09+02:00

pike: safety check for null node

---

Modified: src/modules/pike/ip_tree.c

---

Diff:  https://github.com/kamailio/kamailio/commit/c9dc0336a33a0ecfe776975be7fbfab8f3c91b48.diff
Patch: https://github.com/kamailio/kamailio/commit/c9dc0336a33a0ecfe776975be7fbfab8f3c91b48.patch

---

diff --git a/src/modules/pike/ip_tree.c b/src/modules/pike/ip_tree.c
index e8b93b84f2..c0324c0476 100644
--- a/src/modules/pike/ip_tree.c
+++ b/src/modules/pike/ip_tree.c
@@ -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;




More information about the sr-dev mailing list