[SR-Dev] git:master: core expr: fix invalid pvar string conversions

Andrei Pelinescu-Onciul andrei at iptel.org
Fri Apr 24 21:52:44 CEST 2009


Module: sip-router
Branch: master
Commit: 644f19d3722faef5928344c7dfbdd4c8fd512823
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=644f19d3722faef5928344c7dfbdd4c8fd512823

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Fri Apr 24 19:42:09 2009 +0200

core expr: fix invalid pvar string conversions

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

---

 rvalue.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/rvalue.c b/rvalue.c
index 800a6b9..897fb4d 100644
--- a/rvalue.c
+++ b/rvalue.c
@@ -785,7 +785,6 @@ int rval_get_tmp_str(struct run_act_ctx* h, struct sip_msg* msg,
 								struct rval_cache* tmp_cache)
 {
 	avp_t* r_avp;
-	pv_value_t pval;
 	int i;
 	
 	switch(rv->type){
@@ -857,18 +856,18 @@ int rval_get_tmp_str(struct run_act_ctx* h, struct sip_msg* msg,
 					tmpv->s=int2str(i, &tmpv->len);
 				}else goto error;
 			}else{
-				memset(&pval, 0, sizeof(pval));
+				memset(&tmp_cache->c.pval, 0, sizeof(tmp_cache->c.pval));
 				if (likely(pv_get_spec_value(msg, &rv->v.pvs,
 												&tmp_cache->c.pval)==0)){
-					if (likely(pval.flags & PV_VAL_STR)){
+					if (likely(tmp_cache->c.pval.flags & PV_VAL_STR)){
 						/*  the value is not destroyed, but saved instead
 							in tmp_cache so that it can be destroyed later
 							when no longer needed */
 						tmp_cache->cache_type=RV_CACHE_PVAR;
 						tmp_cache->val_type=RV_STR;
 						*tmpv=tmp_cache->c.pval.rs;
-					}else if (likely(pval.flags & PV_VAL_INT)){
-						i=pval.ri;
+					}else if (likely(tmp_cache->c.pval.flags & PV_VAL_INT)){
+						i=tmp_cache->c.pval.ri;
 						pv_value_destroy(&tmp_cache->c.pval);
 						tmpv->s=int2str(i, &tmpv->len);
 					}else{




More information about the sr-dev mailing list