Skip to content

Commit

Permalink
core: msg translator - duplicate reply via xavp params and handle errors
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Apr 3, 2024
1 parent 3b09fd3 commit 5f83d4f
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/core/msg_translator.c
Original file line number Diff line number Diff line change
Expand Up @@ -2362,6 +2362,7 @@ char *generate_res_buf_from_sip_res(
char *buf;
unsigned int len;
str xparams;
str sdup;
sr_lump_t *anchor;

buf = msg->buf;
Expand Down Expand Up @@ -2393,11 +2394,18 @@ char *generate_res_buf_from_sip_res(
anchor = anchor_lump(msg,
msg->via2->params.s + msg->via2->params.len - msg->buf, 0,
0);
if(anchor != NULL) {
if(insert_new_lump_after(anchor, xparams.s, xparams.len, 0)
== 0) {
LM_ERR("unable to add via reply xavp params\n");
}
if(anchor == NULL) {
LM_ERR("unable to get the anchor\n");
goto error;
}
if(pkg_str_dup(&sdup, &xparams) < 0) {
PKG_MEM_ERROR;
goto error;
}
if(insert_new_lump_after(anchor, sdup.s, sdup.len, 0) == 0) {
LM_ERR("unable to add via reply xavp params\n");
pkg_free(sdup.s);
goto error;
}
}
}
Expand Down

0 comments on commit 5f83d4f

Please sign in to comment.