Просмотр исходного кода

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

Daniel-Constantin Mierla 5 лет назад
Родитель
Сommit
29dde9fea1
1 измененных файлов с 11 добавлено и 0 удалено
  1. 11 0
      src/modules/usrloc/dlist.c

+ 11 - 0
src/modules/usrloc/dlist.c

@@ -792,13 +792,24 @@ int get_udomain(const char* _n, udomain_t** _d)
 	dlist_t* d;
 	dlist_t* d;
 	str s;
 	str s;
 
 
+	if(_n == NULL) {
+		LM_ERR("null location table name\n");
+		goto notfound;
+	}
+
 	s.s = (char*)_n;
 	s.s = (char*)_n;
 	s.len = strlen(_n);
 	s.len = strlen(_n);
+	if(s.len <= 0) {
+		LM_ERR("empty location table name\n");
+		goto notfound;
+	}
 
 
 	if (find_dlist(&s, &d) == 0) {
 	if (find_dlist(&s, &d) == 0) {
 		*_d = d->d;
 		*_d = d->d;
 		return 0;
 		return 0;
 	}
 	}
+
+notfound:
 	*_d = NULL;
 	*_d = NULL;
 	return -1;
 	return -1;
 }
 }