Browse code

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

(cherry picked from commit 29dde9fea1eb21b4bb484286f7443dd32f611bd2)

Daniel-Constantin Mierla authored on 27/08/2020 10:34:50
Showing 1 changed files
... ...
@@ -792,13 +792,24 @@ int get_udomain(const char* _n, udomain_t** _d)
792 792
 	dlist_t* d;
793 793
 	str s;
794 794
 
795
+	if(_n == NULL) {
796
+		LM_ERR("null location table name\n");
797
+		goto notfound;
798
+	}
799
+
795 800
 	s.s = (char*)_n;
796 801
 	s.len = strlen(_n);
802
+	if(s.len <= 0) {
803
+		LM_ERR("empty location table name\n");
804
+		goto notfound;
805
+	}
797 806
 
798 807
 	if (find_dlist(&s, &d) == 0) {
799 808
 		*_d = d->d;
800 809
 		return 0;
801 810
 	}
811
+
812
+notfound:
802 813
 	*_d = NULL;
803 814
 	return -1;
804 815
 }