Module: kamailio
Branch: 5.3
Commit: c4908816950d12eade4a320f399f74eb4ec91599
URL:
https://github.com/kamailio/kamailio/commit/c4908816950d12eade4a320f399f74e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-03-14T18:03:30+01:00
siptrace: proper setting of dst field when correlation id is not set
- GH #2250
(cherry picked from commit f0ae3c37cdaf4c5d8034062bf27ebeb03aacb99f)
---
Modified: src/modules/siptrace/siptrace.c
---
Diff:
https://github.com/kamailio/kamailio/commit/c4908816950d12eade4a320f399f74e…
Patch:
https://github.com/kamailio/kamailio/commit/c4908816950d12eade4a320f399f74e…
---
diff --git a/src/modules/siptrace/siptrace.c b/src/modules/siptrace/siptrace.c
index 861161996b..ccd0b72508 100644
--- a/src/modules/siptrace/siptrace.c
+++ b/src/modules/siptrace/siptrace.c
@@ -814,6 +814,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);
@@ -857,17 +858,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 {