Skip to content

Commit

Permalink
s.fill transformation: Prioritize string pvars over integer ones
Browse files Browse the repository at this point in the history
Reason for this is that a pvar which holds a string is a more
particular occurrence than an int one, since integers can be
easily stringified.

This fixes some issues with pvars which have multiple internal
representations (e.g. $rm is "INVITE" and 1 at the same time)

Reported by Eric Tamme
  • Loading branch information
liviuchircu committed Jun 2, 2015
1 parent 954e771 commit 0db7e0e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions transformations.c
Expand Up @@ -688,12 +688,12 @@ int tr_eval_string(struct sip_msg *msg, tr_param_t *tp, int subtype,
/* padded final length parameter */
i = tp->next->v.n;

if (val->flags & PV_VAL_INT)
if (val->flags & PV_VAL_STR)
{
val->rs.s = int2str(val->ri, &val->rs.len);
i -= val->rs.len;
} else if (val->flags & PV_VAL_STR)
} else if (val->flags & PV_VAL_INT)
{
val->rs.s = int2str(val->ri, &val->rs.len);
i -= val->rs.len;
}

Expand Down

0 comments on commit 0db7e0e

Please sign in to comment.