Browse code

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

(cherry picked from commit 29dde9fea1eb21b4bb484286f7443dd32f611bd2)
(cherry picked from commit ac56dfde20c5e689fb911debdd33a6155f7b130c)

Daniel-Constantin Mierla authored on 27/08/2020 10:34:50
Showing 1 changed files
... ...
@@ -597,13 +597,24 @@ int get_udomain(const char* _n, udomain_t** _d)
597 597
 	dlist_t* d;
598 598
 	str s;
599 599
 
600
+	if(_n == NULL) {
601
+		LM_ERR("null location table name\n");
602
+		goto notfound;
603
+	}
604
+
600 605
 	s.s = (char*)_n;
601 606
 	s.len = strlen(_n);
607
+	if(s.len <= 0) {
608
+		LM_ERR("empty location table name\n");
609
+		goto notfound;
610
+	}
602 611
 
603 612
 	if (find_dlist(&s, &d) == 0) {
604 613
 		*_d = d->d;
605 614
 		return 0;
606 615
 	}
616
+
617
+notfound:
607 618
 	*_d = NULL;
608 619
 	return -1;
609 620
 }