Module: kamailio
Branch: master
Commit: b50159d60dec4ffc671e424cc849e4cde4e9bfb5
URL:
https://github.com/kamailio/kamailio/commit/b50159d60dec4ffc671e424cc849e4c…
Author: Jose Luis Verdeguer <pepeluxx(a)gmail.com>
Committer: Jose Luis Verdeguer <pepeluxx(a)gmail.com>
Date: 2019-03-12T11:13:41+01:00
secfilter: avoid dereferences null
---
Modified: src/modules/secfilter/secfilter.c
---
Diff:
https://github.com/kamailio/kamailio/commit/b50159d60dec4ffc671e424cc849e4c…
Patch:
https://github.com/kamailio/kamailio/commit/b50159d60dec4ffc671e424cc849e4c…
---
diff --git a/src/modules/secfilter/secfilter.c b/src/modules/secfilter/secfilter.c
index 4816c4ad9d..d229031f30 100644
--- a/src/modules/secfilter/secfilter.c
+++ b/src/modules/secfilter/secfilter.c
@@ -424,6 +424,10 @@ static int check_user(struct sip_msg *msg, int type)
if(res != 0) {
return res;
}
+
+ if (user.s == NULL || domain.s == NULL) {
+ return -1;
+ }
nlen = name.len;
ulen = user.len;
@@ -434,9 +438,11 @@ static int check_user(struct sip_msg *msg, int type)
while(list) {
if(name.len > list->s.len)
name.len = list->s.len;
- res = cmpi_str(&list->s, &name);
- if(res == 0) {
- return 4;
+ if (name.s != NULL) {
+ res = cmpi_str(&list->s, &name);
+ if(res == 0) {
+ return 4;
+ }
}
if(user.len > list->s.len)
user.len = list->s.len;
@@ -453,9 +459,11 @@ static int check_user(struct sip_msg *msg, int type)
while(list) {
if(name.len > list->s.len)
name.len = list->s.len;
- res = cmpi_str(&list->s, &name);
- if(res == 0) {
- return -4;
+ if (name.s != NULL) {
+ res = cmpi_str(&list->s, &name);
+ if(res == 0) {
+ return -4;
+ }
}
if(user.len > list->s.len)
user.len = list->s.len;