Module: kamailio
Branch: master
Commit: 47e0649eca286bfc26c39dd1142169fc06eea077
URL:
https://github.com/kamailio/kamailio/commit/47e0649eca286bfc26c39dd1142169f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-10-01T12:22:34+02:00
pdt: init len variable to avoid using garbage value
---
Modified: src/modules/pdt/pdtree.c
---
Diff:
https://github.com/kamailio/kamailio/commit/47e0649eca286bfc26c39dd1142169f…
Patch:
https://github.com/kamailio/kamailio/commit/47e0649eca286bfc26c39dd1142169f…
---
diff --git a/src/modules/pdt/pdtree.c b/src/modules/pdt/pdtree.c
index e55f5bdfa5..d0ff43871a 100644
--- a/src/modules/pdt/pdtree.c
+++ b/src/modules/pdt/pdtree.c
@@ -278,7 +278,6 @@ str* get_domain(pdt_tree_t *pt, str *sp, int *plen)
*plen = len;
return domain;
-
}
/**
@@ -287,7 +286,7 @@ str* get_domain(pdt_tree_t *pt, str *sp, int *plen)
str* pdt_get_domain(pdt_tree_t *pl, str* sdomain, str *code, int *plen)
{
pdt_tree_t *it;
- int len;
+ int len = 0;
str *domain=NULL;
if(pl==NULL || sdomain==NULL || sdomain->s==NULL || code == NULL
@@ -300,13 +299,14 @@ str* pdt_get_domain(pdt_tree_t *pl, str* sdomain, str *code, int
*plen)
it = pl;
while(it!=NULL && str_strcmp(&it->sdomain, sdomain)<0)
it = it->next;
-
+
if(it==NULL || str_strcmp(&it->sdomain, sdomain)>0)
return NULL;
-
+
domain = get_domain(it, code, &len);
if(plen!=NULL)
- *plen = len;
+ *plen = len;
+
return domain;
}