<p>Hi,</p>

<p>I'm testing on 4.4.</p>

<p>The 'new design' isn't documented, so I can't figure out how the name will be generated. <br>
When use simple config:</p>

<pre><code>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")
</code></pre>

<p>sipcapture uses given table name as format string, but the final result was<br>
<code>'sip_capture.....A'</code>. So no any timestamp in the name. The reason for this could be next two lines:</p>

<pre><code>ntab.len = strftime(strftime_buf, sizeof(strftime_buf), table->s,  &capt_ts);
ntab.s = strftime_buf;
</code></pre>

<p>The table->s not necessary ends with '\0', because it's part of Kamailio internal str structure.<br>
Avoid non zero terminated string will work in this case.</p>

<p>Parsing loop in parse_table_names function doesn't add '\0' at the end of table name.<br>
Suggested patch is here.</p>

<pre><code>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");
        }
</code></pre>

<p>BTW, can you explain what 'table->s'  will contain (format string required by strftime) using provided example config ?</p>

<p>Thanks,<br>
Seudin</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly or <a href="https://github.com/kamailio/kamailio/issues/566#issuecomment-210343805">view it on GitHub</a><img alt="" height="1" src="https://github.com/notifications/beacon/AF36ZWwy80lqKlFkMDy83HFBdpjxA7jyks5p30PCgaJpZM4IHaoa.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/kamailio/kamailio/issues/566#issuecomment-210343805"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>