Module: kamailio
Branch: 4.4
Commit: 98729f05a8e1b9b7edb1a1009075fc4a7bfcfd0a
URL:
https://github.com/kamailio/kamailio/commit/98729f05a8e1b9b7edb1a1009075fc4…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-03-28T16:03:32+02:00
pv: proper evaluation of pv param for param.count transformation
- reported by GH #1041
(cherry picked from commit 964557553fd39fca1de35cf7d2f9e64134da7495)
(cherry picked from commit 26080154471b41198b1bd1df40fe5f1a0f461c8c)
---
Modified: modules/pv/pv_trans.c
---
Diff:
https://github.com/kamailio/kamailio/commit/98729f05a8e1b9b7edb1a1009075fc4…
Patch:
https://github.com/kamailio/kamailio/commit/98729f05a8e1b9b7edb1a1009075fc4…
---
diff --git a/modules/pv/pv_trans.c b/modules/pv/pv_trans.c
index dfccc75..aefa0e6 100644
--- a/modules/pv/pv_trans.c
+++ b/modules/pv/pv_trans.c
@@ -1259,6 +1259,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 = ';';
@@ -1272,17 +1273,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];
}
}