[sr-dev] git:master:47e0649e: pdt: init len variable to avoid using garbage value
Daniel-Constantin Mierla
miconda at gmail.com
Tue Oct 1 12:58:25 CEST 2019
Module: kamailio
Branch: master
Commit: 47e0649eca286bfc26c39dd1142169fc06eea077
URL: https://github.com/kamailio/kamailio/commit/47e0649eca286bfc26c39dd1142169fc06eea077
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at 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/47e0649eca286bfc26c39dd1142169fc06eea077.diff
Patch: https://github.com/kamailio/kamailio/commit/47e0649eca286bfc26c39dd1142169fc06eea077.patch
---
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;
}
More information about the sr-dev
mailing list