Module: kamailio
Branch: 5.2
Commit: fdb54474b7a7cbe953f7869be41459650493e551
URL:
https://github.com/kamailio/kamailio/commit/fdb54474b7a7cbe953f7869be414596…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-10-07T10:42:45+02:00
pdt: init len variable to avoid using garbage value
(cherry picked from commit 47e0649eca286bfc26c39dd1142169fc06eea077)
---
Modified: src/modules/pdt/pdtree.c
---
Diff:
https://github.com/kamailio/kamailio/commit/fdb54474b7a7cbe953f7869be414596…
Patch:
https://github.com/kamailio/kamailio/commit/fdb54474b7a7cbe953f7869be414596…
---
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;
}