Module: kamailio Branch: master Commit: a3a63655dbcbf1bc8067f34c36f4a7295b2a1745 URL: https://github.com/kamailio/kamailio/commit/a3a63655dbcbf1bc8067f34c36f4a729...
Author: emvondo 106535097+emvondo@users.noreply.github.com Committer: GitHub noreply@github.com Date: 2024-07-18T10:10:33+02:00
siprepo: fix int params and wrong copy data in siprepo_msg_async_pull (#3919)
* siprepo: fix int params and wrong copy data in siprepo_msg_async_pull
---------
Co-authored-by: emvondo bycl2332@orange.com
---
Modified: src/modules/siprepo/siprepo_data.c Modified: src/modules/siprepo/siprepo_mod.c
---
Diff: https://github.com/kamailio/kamailio/commit/a3a63655dbcbf1bc8067f34c36f4a729... Patch: https://github.com/kamailio/kamailio/commit/a3a63655dbcbf1bc8067f34c36f4a729...
---
diff --git a/src/modules/siprepo/siprepo_data.c b/src/modules/siprepo/siprepo_data.c index 397def720fb..2720c50c2c0 100644 --- a/src/modules/siprepo/siprepo_data.c +++ b/src/modules/siprepo/siprepo_data.c @@ -496,15 +496,15 @@ int siprepo_msg_async_pull(str *callid, str *msgid, str *gname, str *rname, return -1; } stp->callid.s = (char*)stp + ROUND_POINTER(sizeof(siprepo_task_param_t)); - memcpy(callid->s, stp->callid.s, callid->len); + memcpy(stp->callid.s, callid->s, callid->len); stp->callid.len = callid->len;
stp->msgid.s = stp->callid.s + ROUND_POINTER(callid->len + 1); - memcpy(msgid->s, stp->msgid.s, msgid->len); + memcpy(stp->msgid.s, msgid->s, msgid->len); stp->msgid.len = msgid->len;
stp->rname.s = stp->msgid.s + ROUND_POINTER(msgid->len + 1); - memcpy(rname->s, stp->rname.s, rname->len); + memcpy(stp->rname.s, rname->s, rname->len); stp->rname.len = rname->len;
stp->rmode = rmode; diff --git a/src/modules/siprepo/siprepo_mod.c b/src/modules/siprepo/siprepo_mod.c index d8f8b02c5ad..e6acc23368e 100644 --- a/src/modules/siprepo/siprepo_mod.c +++ b/src/modules/siprepo/siprepo_mod.c @@ -58,6 +58,8 @@ static int w_sr_msg_check(sip_msg_t *msg, char *p1, char *p2);
static void siprepo_timer_exec(unsigned int ticks, int worker, void *param);
+static int fixup_sr_msg_async_pull(void **param, int param_no); + /* clang-format off */ typedef struct sworker_task_param { char *buf; @@ -69,10 +71,10 @@ typedef struct sworker_task_param { static cmd_export_t cmds[]={ {"sr_msg_push", (cmd_function)w_sr_msg_push, 2, fixup_spve_igp, fixup_free_spve_null, REQUEST_ROUTE|CORE_ONREPLY_ROUTE}, - {"sr_msg_pull", (cmd_function)w_sr_msg_pull, 3, fixup_spve_all, - fixup_free_spve_all, REQUEST_ROUTE|CORE_ONREPLY_ROUTE}, - {"sr_msg_async_pull", (cmd_function)w_sr_msg_async_pull, 5, fixup_spve_all, - fixup_free_spve_all, ANY_ROUTE}, + {"sr_msg_pull", (cmd_function)w_sr_msg_pull, 4, fixup_sssi, + fixup_free_sssi, REQUEST_ROUTE|CORE_ONREPLY_ROUTE}, + {"sr_msg_async_pull", (cmd_function)w_sr_msg_async_pull, 5, fixup_sr_msg_async_pull, + 0, ANY_ROUTE}, {"sr_msg_rm", (cmd_function)w_sr_msg_rm, 2, fixup_spve_spve, fixup_free_spve_spve, REQUEST_ROUTE|CORE_ONREPLY_ROUTE}, {"sr_msg_check", (cmd_function)w_sr_msg_check, 0, 0, @@ -282,6 +284,15 @@ static int w_sr_msg_async_pull(sip_msg_t *msg, char *pcallid, char *pmsgid, }
+static int fixup_sr_msg_async_pull(void **param, int param_no) +{ + if(param_no >= 1 && param_no <= 4) + return fixup_spve_null(param, 1); + if(param_no == 5) + return fixup_igp_null(param, 1); + return 0; +} + /** * */