Module: kamailio
Branch: master
Commit: 15c7f861d72c57ee57f41c108d948027e50a0a27
URL:
https://github.com/kamailio/kamailio/commit/15c7f861d72c57ee57f41c108d94802…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-04-19T08:02:44+02:00
siprepo: translate pointers to the new buffer
- GH #3418
---
Modified: src/modules/siprepo/siprepo_data.c
---
Diff:
https://github.com/kamailio/kamailio/commit/15c7f861d72c57ee57f41c108d94802…
Patch:
https://github.com/kamailio/kamailio/commit/15c7f861d72c57ee57f41c108d94802…
---
diff --git a/src/modules/siprepo/siprepo_data.c b/src/modules/siprepo/siprepo_data.c
index f389fc3649d..6aea04833b4 100644
--- a/src/modules/siprepo/siprepo_data.c
+++ b/src/modules/siprepo/siprepo_data.c
@@ -202,21 +202,35 @@ int siprepo_msg_set(sip_msg_t *msg, str *msgid, int rmode)
}
memset(it, 0, dsize);
- it->dbuf.s = (char*)it + ROUND_POINTER(sizeof(siprepo_msg_t));
+ it->msgid.s = (char*)it + ROUND_POINTER(sizeof(siprepo_msg_t));
+ it->msgid.len = msgid->len;
+ memcpy(it->msgid.s, msgid->s, msgid->len);
+
+ it->dbuf.s = (char*)it + ROUND_POINTER(sizeof(siprepo_msg_t))
+ + ROUND_POINTER(msgid->len + 1);
+ it->dbuf.len = msg->len;
+ memcpy(it->dbuf.s, msg->buf, msg->len);
+
it->callid.len = scallid.len;
- it->callid.s = translate_pointer(it->dbuf.s, msg->buf, it->callid.s);
+ it->callid.s = translate_pointer(it->dbuf.s, msg->buf, scallid.s);
it->cseqmet = get_cseq(msg)->method;
trim(&it->cseqmet);
+ it->cseqmet.s = translate_pointer(it->dbuf.s, msg->buf, it->cseqmet.s);
+
it->cseqnum = get_cseq(msg)->number;
trim(&it->cseqnum);
+ it->cseqnum.s = translate_pointer(it->dbuf.s, msg->buf, it->cseqnum.s);
+
it->ftag = get_from(msg)->tag_value;
trim(&it->ftag);
+ it->ftag.s = translate_pointer(it->dbuf.s, msg->buf, it->ftag.s);
vbr = msg->via1->branch;
if(likely(vbr!=NULL)) {
it->vbranch = vbr->value;
trim(&it->vbranch);
+ it->vbranch.s = translate_pointer(it->dbuf.s, msg->buf, it->vbranch.s);
}
it->hid = get_hash1_raw(it->callid.s, it->callid.len);