Hi,
I'm testing on 4.4.
The 'new design' isn't documented, so I can't figure out how the name will
be generated.
When use simple config:
```
modparam("sipcapture", "db_url", DBURL)
modparam("sipcapture", "capture_on", 1)
modparam("sipcapture", "hep_capture_on", 1)
modparam("sipcapture", "raw_ipip_capture_on", 0)
modparam("sipcapture", "table_name", "sip_capture")
```
sipcapture uses given table name as format string, but the final result was
`'sip_capture.....A'`. So no any timestamp in the name. The reason for this could
be next two lines:
```
ntab.len = strftime(strftime_buf, sizeof(strftime_buf), table->s, &capt_ts);
ntab.s = strftime_buf;
```
The table->s not necessary ends with '\0', because it's part of Kamailio
internal str structure.
Avoid non zero terminated string will work in this case.
Parsing loop in parse_table_names function doesn't add '\0' at the end of
table name.
Suggested patch is here.
```
diff --git a/modules/sipcapture/sipcapture.c b/modules/sipcapture/sipcapture.c
index 41d153e..2bdb4b4 100644
--- a/modules/sipcapture/sipcapture.c
+++ b/modules/sipcapture/sipcapture.c
@@ -436,8 +436,9 @@ int parse_table_names (str table_name, str ** table_names){
{
LM_INFO ("INFO: table name:%s\n",p);
names[i].len = strlen (p);
- names[i].s = (char *)pkg_malloc(sizeof(char) *names[i].len);
+ names[i].s = (char *)pkg_malloc(sizeof(char) *(names[i].len + 1));
memcpy(names[i].s, p, names[i].len);
+ names[i].s[names[i].len] = '\0';
i++;
p = strtok (NULL, "| \t");
}
```
BTW, can you explain what 'table->s' will contain (format string required by
strftime) using provided example config ?
Thanks,
Seudin
---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/566#issuecomment-210343805