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.
  • Loading branch information
bogdan-iancu committed Jan 16, 2024
1 parent 224a323 commit 1a11c03
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 @@ -2020,8 +2020,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 @@ -2048,10 +2046,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 @@ -2061,8 +2061,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 1a11c03

Please sign in to comment.