<h3>Description</h3>
<p>Providing Kamailio with a domain name longer than 72 chars causes Kamailio to crash with an error in <code>fix_sock_str</code>. Looking at the code it appears that the <code>fix_sock_str</code> function only assumes it is being passed IP addresses so the buffer length is configured for the length of an IPv6 address represented as a string.</p>
<p>It appears to include the portion of the string representing the port as can be seen in the two example config lines below.</p>
<h4>Reproduction</h4>
<p>The problem can be reproduced by adding the following line to the <code>kamailio.cfg</code> and running <code>kamailio</code> with the <code>-c</code> config check option.</p>
<pre><code>listen=tcp:eth0:5060 advertise "example.example.example.example.example.example.example.example.exa":50
listen=tcp:eth0:5061 advertise "example.example.example.example.example.example.example.example.e":5060
</code></pre>
<h4>Debugging Data</h4>
<p>N/A</p>
<h4>Log Messages</h4>
<pre><code> 0(100) ERROR: <core> [core/socket_info.c:376]: socketinfo2str(): Destionation buffer too short
 0(100) BUG: <core> [core/socket_info.c:443]: fix_sock_str(): fix_sock_str: Error in socket to str
 0(100) ERROR: <core> [core/socket_info.c:1841]: fix_all_socket_lists(): fix_socket_list tcp failed
failed to initialize list addresses
</code></pre>
<h4>SIP Traffic</h4>
<p>N/A</p>
<h3>Possible Solutions</h3>
<p>Don't use listen addresses longer than 70 chars.</p>
<h3>Additional Information</h3>
<ul>
<li><strong>Kamailio Version</strong> - output of <code>kamailio -v</code></li>
</ul>
<pre><code>version: kamailio 5.2.2 (x86_64/linux) 
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144 MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown 
compiled with gcc 6.3.0
</code></pre>
<ul>
<li><strong>Operating System</strong>:<br>
Debian container running on Arch Linux host.</li>
</ul>
<pre><code>Debian GNU/Linux 9 (stretch)
Linux 75dbf08c8303 5.0.3-arch1-1-ARCH #1 SMP PREEMPT Tue Mar 19 13:09:13 UTC 2019 x86_64 GNU/Linux
</code></pre>

<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, <a href="https://github.com/kamailio/kamailio/issues/1901">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36ZRpm44UIa3gRmvYvxNQJ714pD9bRks5vZDqrgaJpZM4cCs_l">mute the thread</a>.<img src="https://github.com/notifications/beacon/AF36ZYXQo2UzoS20Z6YXtnM75tLFRmT-ks5vZDqrgaJpZM4cCs_l.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"DESCRIPTION","message":"Domain names longer than 70 (#1901)"}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1901"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/1901",
"url": "https://github.com/kamailio/kamailio/issues/1901",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>