Skip to content

Commit 1a11c03

Browse files
committed
Fix printing all values of branch(subfield)
The [*] range was printing all the time the URI subfield of the branches, instead of the requested one.
1 parent 224a323 commit 1a11c03

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pvar.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2020,8 +2020,6 @@ static inline int get_branch_field( int idx, pv_name_t *pvn, pv_value_t *res)
20202020
static int pv_get_branch_fields(struct sip_msg *msg, pv_param_t *param,
20212021
pv_value_t *res)
20222022
{
2023-
str uri;
2024-
qvalue_t q;
20252023
int idx;
20262024
int idxf;
20272025
char *p;
@@ -2048,10 +2046,12 @@ static int pv_get_branch_fields(struct sip_msg *msg, pv_param_t *param,
20482046
p = pv_local_buf;
20492047
idx = 0;
20502048

2051-
while ( (uri.s=get_branch(idx, &uri.len, &q, 0, 0, 0, 0))!=NULL ) {
2049+
while ( idx<get_nr_branches() ) {
2050+
2051+
get_branch_field( idx, &param->pvn, res);
20522052

20532053
if ( pv_local_buf + PV_LOCAL_BUF_SIZE <=
2054-
p + uri.len + PV_FIELD_DELIM_LEN ) {
2054+
p + res->rs.len + PV_FIELD_DELIM_LEN ) {
20552055
LM_ERR("local buffer length exceeded\n");
20562056
return pv_get_null(msg, param, res);
20572057
}
@@ -2061,8 +2061,8 @@ static int pv_get_branch_fields(struct sip_msg *msg, pv_param_t *param,
20612061
p += PV_FIELD_DELIM_LEN;
20622062
}
20632063

2064-
memcpy(p, uri.s, uri.len);
2065-
p += uri.len;
2064+
memcpy(p, res->rs.s, res->rs.len);
2065+
p += res->rs.len;
20662066
idx++;
20672067
}
20682068

0 commit comments

Comments
 (0)