[sr-dev] git:master:29dde9fe: usrloc: get_udomain() - safety checks for location table name parameter

Daniel-Constantin Mierla miconda at gmail.com
Thu Aug 27 12:35:40 CEST 2020


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2020-08-27T12:34:50+02:00

usrloc: get_udomain() - safety checks for location table name parameter

---

Modified: src/modules/usrloc/dlist.c

---

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

---

diff --git a/src/modules/usrloc/dlist.c b/src/modules/usrloc/dlist.c
index cba8ec425c..96a95fe3c9 100644
--- a/src/modules/usrloc/dlist.c
+++ b/src/modules/usrloc/dlist.c
@@ -792,13 +792,24 @@ int get_udomain(const char* _n, udomain_t** _d)
 	dlist_t* d;
 	str s;
 
+	if(_n == NULL) {
+		LM_ERR("null location table name\n");
+		goto notfound;
+	}
+
 	s.s = (char*)_n;
 	s.len = strlen(_n);
+	if(s.len <= 0) {
+		LM_ERR("empty location table name\n");
+		goto notfound;
+	}
 
 	if (find_dlist(&s, &d) == 0) {
 		*_d = d->d;
 		return 0;
 	}
+
+notfound:
 	*_d = NULL;
 	return -1;
 }




More information about the sr-dev mailing list