[Asterisk-code-review] main/stun.c: fix crash upon STUN request timeout (asterisk[19])
Sébastien Duthil
asteriskteam at digium.com
Thu Oct 14 10:32:01 CDT 2021
Sébastien Duthil has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/16610 )
Change subject: main/stun.c: fix crash upon STUN request timeout
......................................................................
main/stun.c: fix crash upon STUN request timeout
Some ast_stun_request users do not provide a destination address when
sending to a connection-mode socket.
ASTERISK-29691
Change-Id: Idd9114c3380216ba48abfc3c68619e79ad37defc
---
M main/stun.c
1 file changed, 8 insertions(+), 4 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/10/16610/1
diff --git a/main/stun.c b/main/stun.c
index 4e9dac1..1a9434f 100644
--- a/main/stun.c
+++ b/main/stun.c
@@ -239,17 +239,21 @@
static void handle_stun_timeout(int retry, struct sockaddr_in *dst)
{
+ const char *stun_server = "unknown server";
+ if (dst) {
+ stun_server = ast_inet_ntoa(dst->sin_addr);
+ }
if (retry < STUN_MAX_RETRIES) {
ast_log(LOG_NOTICE,
- "Attempt %d to send STUN request to '%s' timed out.",
+ "Attempt %d to send STUN request to '%s' timed out.\n",
retry,
- ast_inet_ntoa(dst->sin_addr));
+ stun_server);
} else {
ast_log(LOG_WARNING,
- "Attempt %d to send STUN request to '%s' timed out."
+ "Attempt %d to send STUN request to '%s' timed out. "
"Check that the server address is correct and reachable.\n",
retry,
- ast_inet_ntoa(dst->sin_addr));
+ stun_server);
}
}
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/16610
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 19
Gerrit-Change-Id: Idd9114c3380216ba48abfc3c68619e79ad37defc
Gerrit-Change-Number: 16610
Gerrit-PatchSet: 1
Gerrit-Owner: Sébastien Duthil <sduthil at wazo.community>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20211014/e7cca00e/attachment.html>
More information about the asterisk-code-review
mailing list