Skip to content

Commit

Permalink
siptrace: proper setting of dst field when correlation id is not set
Browse files Browse the repository at this point in the history
- GH #2250
  • Loading branch information
miconda committed Mar 13, 2020
1 parent 6a8e273 commit f0ae3c3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/modules/siptrace/siptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,7 @@ static int sip_trace_helper(sip_msg_t *msg, dest_info_t *dst, str *duri,
str *corid, char *dir, enum siptrace_type_t trace_type)
{
siptrace_info_t* info = NULL;
char *p = NULL;

if (trace_type == SIPTRACE_TRANSACTION || trace_type == SIPTRACE_DIALOG) {
int alloc_size = sizeof(siptrace_info_t);
Expand Down Expand Up @@ -876,17 +877,18 @@ static int sip_trace_helper(sip_msg_t *msg, dest_info_t *dst, str *duri,
}
memset(info, 0, alloc_size);

p = (char *)(info + 1);
/* could use the dest_info we've already parsed but there's no way to pass
* it to DLGCB_CREATED callback so the only thing to do is keep
* it as uri, serialize in a dlg_var and parse again in DLGCB_CREATED */
if(corid) {
info->correlation_id.s = (char *)(info + 1);
info->correlation_id.s = p;
info->correlation_id.len = corid->len;
memcpy(info->correlation_id.s, corid->s, corid->len);
}
if (duri) {
info->uriState = STRACE_RAW_URI;
info->u.dup_uri.s = (char *)info->correlation_id.s + info->correlation_id.len;
info->u.dup_uri.s = p + ((info->correlation_id.s)?info->correlation_id.len:0);
memcpy(info->u.dup_uri.s, duri->s, duri->len);
info->u.dup_uri.len = duri->len;
} else {
Expand Down

0 comments on commit f0ae3c3

Please sign in to comment.