[sr-dev] git:master:c881ab1a: drouting: check return of get_node_index() to avoid negative index

Daniel-Constantin Mierla miconda at gmail.com
Mon Jan 30 17:48:26 CET 2017


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2017-01-30T17:46:39+01:00

drouting: check return of get_node_index() to avoid negative index

---

Modified: src/modules/drouting/prefix_tree.c

---

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

---

diff --git a/src/modules/drouting/prefix_tree.c b/src/modules/drouting/prefix_tree.c
index cb6c64a..7eddab6 100644
--- a/src/modules/drouting/prefix_tree.c
+++ b/src/modules/drouting/prefix_tree.c
@@ -154,7 +154,7 @@ get_prefix(
 			goto err_exit;
 		/* is it a real node or an intermediate one */
 		idx = get_node_index(*tmp);
-		if(NULL != ptree->ptnode[idx].rg) {
+		if(idx!=-1 && NULL != ptree->ptnode[idx].rg) {
 			/* real node; check the constraints on the routing info*/
 			if( NULL != (rt = internal_check_rt( &(ptree->ptnode[idx]), rgid)))
 				break;
@@ -169,7 +169,7 @@ get_prefix(
 }
 
 
-pgw_t* 
+pgw_t*
 get_pgw(
 		pgw_t* pgw_l,
 		long id




More information about the sr-dev mailing list