Skip to content

Commit

Permalink
Fix printing all values of branch(subfield)
Browse files Browse the repository at this point in the history
The [*] range was printing all the time the URI subfield of the branches, instead of the requested one.

(cherry picked from commit 1a11c03)
  • Loading branch information
bogdan-iancu committed Jan 16, 2024
1 parent c67280c commit 1e0ea3a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pvar.c
Original file line number Diff line number Diff line change
Expand Up @@ -2024,8 +2024,6 @@ static inline int get_branch_field( int idx, pv_name_t *pvn, pv_value_t *res)
static int pv_get_branch_fields(struct sip_msg *msg, pv_param_t *param,
pv_value_t *res)
{
str uri;
qvalue_t q;
int idx;
int idxf;
char *p;
Expand All @@ -2052,10 +2050,12 @@ static int pv_get_branch_fields(struct sip_msg *msg, pv_param_t *param,
p = pv_local_buf;
idx = 0;

while ( (uri.s=get_branch(idx, &uri.len, &q, 0, 0, 0, 0))!=NULL ) {
while ( idx<get_nr_branches() ) {

get_branch_field( idx, &param->pvn, res);

if ( pv_local_buf + PV_LOCAL_BUF_SIZE <=
p + uri.len + PV_FIELD_DELIM_LEN ) {
p + res->rs.len + PV_FIELD_DELIM_LEN ) {
LM_ERR("local buffer length exceeded\n");
return pv_get_null(msg, param, res);
}
Expand All @@ -2065,8 +2065,8 @@ static int pv_get_branch_fields(struct sip_msg *msg, pv_param_t *param,
p += PV_FIELD_DELIM_LEN;
}

memcpy(p, uri.s, uri.len);
p += uri.len;
memcpy(p, res->rs.s, res->rs.len);
p += res->rs.len;
idx++;
}

Expand Down

0 comments on commit 1e0ea3a

Please sign in to comment.