Module: kamailio Branch: 5.0 Commit: 26080154471b41198b1bd1df40fe5f1a0f461c8c URL: https://github.com/kamailio/kamailio/commit/26080154471b41198b1bd1df40fe5f1a...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2017-03-28T16:02:27+02:00
pv: proper evaluation of pv param for param.count transformation
- reported by GH #1041
(cherry picked from commit 964557553fd39fca1de35cf7d2f9e64134da7495)
---
Modified: src/modules/pv/pv_trans.c
---
Diff: https://github.com/kamailio/kamailio/commit/26080154471b41198b1bd1df40fe5f1a... Patch: https://github.com/kamailio/kamailio/commit/26080154471b41198b1bd1df40fe5f1a...
---
diff --git a/src/modules/pv/pv_trans.c b/src/modules/pv/pv_trans.c index f15975e..6ad9a97 100644 --- a/src/modules/pv/pv_trans.c +++ b/src/modules/pv/pv_trans.c @@ -1294,6 +1294,7 @@ int tr_eval_paramlist(struct sip_msg *msg, tr_param_t *tp, int subtype, pv_value_t *val) { pv_value_t v; + pv_value_t vs; str sv; int n, i; char separator = ';'; @@ -1307,17 +1308,23 @@ int tr_eval_paramlist(struct sip_msg *msg, tr_param_t *tp, int subtype, { if (subtype == TR_PL_COUNT) { - if(tp->type != TR_PARAM_STRING || tp->v.s.len != 1) - return -1; - - separator = tp->v.s.s[0]; - } - else if (tp->next != NULL) - { + if(tp->type != TR_PARAM_STRING) { + if(pv_get_spec_value(msg, (pv_spec_t*)tp->v.data, &vs)!=0 + || (!(vs.flags&PV_VAL_STR)) || vs.rs.len<=0) + { + LM_ERR("value cannot get p1\n"); + return -1; + } + separator = vs.rs.s[0]; + } else { + if(tp->v.s.len != 1) + return -1; + separator = tp->v.s.s[0]; + } + } else if (tp->next != NULL) { if(tp->next->type != TR_PARAM_STRING || tp->next->v.s.len != 1) return -1; - separator = tp->next->v.s.s[0]; } }