Browse code

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).

Andrei Pelinescu-Onciul authored on 14/12/2009 12:00:07
Showing 1 changed files
... ...
@@ -2435,6 +2435,10 @@ avp_pvar:	AVP_OR_PVAR {
2435 2435
 				s_tmp.s=$1; s_tmp.len=strlen(s_tmp.s);
2436 2436
 				if (pv_parse_spec2(&s_tmp, &lval_tmp->lv.pvs, 1)==0){
2437 2437
 					/* not a pvar, try avps */
2438
+					/* lval_tmp might be partially filled by the failed
2439
+					   pv_parse_spec2() (especially if the avp name is the
2440
+					   same as a pv class) => clean it again */
2441
+					memset(lval_tmp, 0, sizeof(*lval_tmp));
2438 2442
 					lval_tmp->lv.avps.type|= AVP_NAME_STR;
2439 2443
 					lval_tmp->lv.avps.name.s.s = s_tmp.s+1;
2440 2444
 					lval_tmp->lv.avps.name.s.len = s_tmp.len-1;