<p>Sébastien Duthil has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/16610">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">main/stun.c: fix crash upon STUN request timeout<br><br>Some ast_stun_request users do not provide a destination address when<br>sending to a connection-mode socket.<br><br>ASTERISK-29691<br><br>Change-Id: Idd9114c3380216ba48abfc3c68619e79ad37defc<br>---<br>M main/stun.c<br>1 file changed, 8 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/10/16610/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/stun.c b/main/stun.c</span><br><span>index 4e9dac1..1a9434f 100644</span><br><span>--- a/main/stun.c</span><br><span>+++ b/main/stun.c</span><br><span>@@ -239,17 +239,21 @@</span><br><span> </span><br><span> static void handle_stun_timeout(int retry, struct sockaddr_in *dst)</span><br><span> {</span><br><span style="color: hsl(120, 100%, 40%);">+ const char *stun_server = "unknown server";</span><br><span style="color: hsl(120, 100%, 40%);">+ if (dst) {</span><br><span style="color: hsl(120, 100%, 40%);">+ stun_server = ast_inet_ntoa(dst->sin_addr);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> if (retry < STUN_MAX_RETRIES) {</span><br><span> ast_log(LOG_NOTICE,</span><br><span style="color: hsl(0, 100%, 40%);">- "Attempt %d to send STUN request to '%s' timed out.",</span><br><span style="color: hsl(120, 100%, 40%);">+ "Attempt %d to send STUN request to '%s' timed out.\n",</span><br><span> retry,</span><br><span style="color: hsl(0, 100%, 40%);">- ast_inet_ntoa(dst->sin_addr));</span><br><span style="color: hsl(120, 100%, 40%);">+ stun_server);</span><br><span> } else {</span><br><span> ast_log(LOG_WARNING,</span><br><span style="color: hsl(0, 100%, 40%);">- "Attempt %d to send STUN request to '%s' timed out."</span><br><span style="color: hsl(120, 100%, 40%);">+ "Attempt %d to send STUN request to '%s' timed out. "</span><br><span> "Check that the server address is correct and reachable.\n",</span><br><span> retry,</span><br><span style="color: hsl(0, 100%, 40%);">- ast_inet_ntoa(dst->sin_addr));</span><br><span style="color: hsl(120, 100%, 40%);">+ stun_server);</span><br><span> }</span><br><span> }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/16610">change 16610</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/16610"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 19 </div>
<div style="display:none"> Gerrit-Change-Id: Idd9114c3380216ba48abfc3c68619e79ad37defc </div>
<div style="display:none"> Gerrit-Change-Number: 16610 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sébastien Duthil <sduthil@wazo.community> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>