Browse code

core expr: fix invalid pvar string conversions

- in some cases pvars where converted in a wrong way to string (an
uninitialized value was used).

Andrei Pelinescu-Onciul authored on 24/04/2009 17:42:09
Showing 1 changed files
... ...
@@ -785,7 +785,6 @@ int rval_get_tmp_str(struct run_act_ctx* h, struct sip_msg* msg,
785 785
 								struct rval_cache* tmp_cache)
786 786
 {
787 787
 	avp_t* r_avp;
788
-	pv_value_t pval;
789 788
 	int i;
790 789
 	
791 790
 	switch(rv->type){
... ...
@@ -857,18 +856,18 @@ int rval_get_tmp_str(struct run_act_ctx* h, struct sip_msg* msg,
857 857
 					tmpv->s=int2str(i, &tmpv->len);
858 858
 				}else goto error;
859 859
 			}else{
860
-				memset(&pval, 0, sizeof(pval));
860
+				memset(&tmp_cache->c.pval, 0, sizeof(tmp_cache->c.pval));
861 861
 				if (likely(pv_get_spec_value(msg, &rv->v.pvs,
862 862
 												&tmp_cache->c.pval)==0)){
863
-					if (likely(pval.flags & PV_VAL_STR)){
863
+					if (likely(tmp_cache->c.pval.flags & PV_VAL_STR)){
864 864
 						/*  the value is not destroyed, but saved instead
865 865
 							in tmp_cache so that it can be destroyed later
866 866
 							when no longer needed */
867 867
 						tmp_cache->cache_type=RV_CACHE_PVAR;
868 868
 						tmp_cache->val_type=RV_STR;
869 869
 						*tmpv=tmp_cache->c.pval.rs;
870
-					}else if (likely(pval.flags & PV_VAL_INT)){
871
-						i=pval.ri;
870
+					}else if (likely(tmp_cache->c.pval.flags & PV_VAL_INT)){
871
+						i=tmp_cache->c.pval.ri;
872 872
 						pv_value_destroy(&tmp_cache->c.pval);
873 873
 						tmpv->s=int2str(i, &tmpv->len);
874 874
 					}else{