[sr-dev] git:kamailio_3.0: core: fix parsing for avps with the same name as a pv class

Daniel-Constantin Mierla miconda at gmail.com
Mon Dec 14 13:20:09 CET 2009


Module: sip-router
Branch: kamailio_3.0
Commit: a1b15f1289db84bdf8e3da11fa33af9ae0501f3c
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a1b15f1289db84bdf8e3da11fa33af9ae0501f3c

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Mon Dec 14 13:00:07 2009 +0100

core: fix parsing for avps with the same name as a pv class

When a pv lookup fails, sometimes the pvspec is partially filled
which, if not clean might mess-up the avp flags in the lval union.
E.g.: $avp="..." caused problems (avp was marked as RE name).

---

 cfg.y |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/cfg.y b/cfg.y
index 2c488a2..0062b0e 100644
--- a/cfg.y
+++ b/cfg.y
@@ -2435,6 +2435,10 @@ avp_pvar:	AVP_OR_PVAR {
 				s_tmp.s=$1; s_tmp.len=strlen(s_tmp.s);
 				if (pv_parse_spec2(&s_tmp, &lval_tmp->lv.pvs, 1)==0){
 					/* not a pvar, try avps */
+					/* lval_tmp might be partially filled by the failed
+					   pv_parse_spec2() (especially if the avp name is the
+					   same as a pv class) => clean it again */
+					memset(lval_tmp, 0, sizeof(*lval_tmp));
 					lval_tmp->lv.avps.type|= AVP_NAME_STR;
 					lval_tmp->lv.avps.name.s.s = s_tmp.s+1;
 					lval_tmp->lv.avps.name.s.len = s_tmp.len-1;




More information about the sr-dev mailing list