Module: kamailio
Branch: master
Commit: d54eed9eb2f3a09a70f679ea0fb7cac64a5aa14a
URL:
https://github.com/kamailio/kamailio/commit/d54eed9eb2f3a09a70f679ea0fb7cac…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2020-05-12T14:46:15+02:00
msilo: use ctime_r() for a safer multi-thread usage
The reentrant version ctime_r() does the same, but
stores
the string in a user-supplied buffer which should have
room for at least 26 bytes.
---
Modified: src/modules/msilo/msilo.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d54eed9eb2f3a09a70f679ea0fb7cac…
Patch:
https://github.com/kamailio/kamailio/commit/d54eed9eb2f3a09a70f679ea0fb7cac…
---
diff --git a/src/modules/msilo/msilo.c b/src/modules/msilo/msilo.c
index bf5758d350..0bf53ecc5a 100644
--- a/src/modules/msilo/msilo.c
+++ b/src/modules/msilo/msilo.c
@@ -1337,6 +1337,7 @@ void m_send_ontimer(unsigned int ticks, void *param)
str str_vals[4], hdr_str, body_str;
str extra_hdrs_str = {0};
time_t stime;
+ char t_buf[26] = {0};
if(ms_reminder.s==NULL)
{
@@ -1384,14 +1385,13 @@ void m_send_ontimer(unsigned int ticks, void *param)
goto done;
}
+ ctime_r((const time_t*)&ttime, t_buf);
if (RES_ROW_N(db_res) <= 0)
{
- LM_DBG("no message for <%.*s>!\n", 24, ctime((const
time_t*)&ttime));
+ LM_DBG("no message for <%.*s>!\n", 24, t_buf);
goto done;
}
-
- LM_DBG("dumping [%d] messages for <%.*s>!!!\n", RES_ROW_N(db_res), 24,
- ctime((const time_t*)&ttime));
+ LM_DBG("dumping [%d] messages for <%.*s>!!!\n", RES_ROW_N(db_res), 24,
t_buf);
for(i = 0; i < RES_ROW_N(db_res); i++)
{