mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-26 22:30:28 +00:00
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
This commit is contained in:
committed by
Sébastien Duthil
parent
9ff955f4d1
commit
4bc7a5ac53
15
main/stun.c
15
main/stun.c
@@ -239,17 +239,24 @@ static void append_attr_address(struct stun_attr **attr, int attrval, struct soc
|
|||||||
|
|
||||||
static void handle_stun_timeout(int retry, struct sockaddr_in *dst)
|
static void handle_stun_timeout(int retry, struct sockaddr_in *dst)
|
||||||
{
|
{
|
||||||
|
char *stun_destination = "";
|
||||||
|
if (dst) {
|
||||||
|
ast_asprintf(&stun_destination, "to '%s' ", ast_inet_ntoa(dst->sin_addr));
|
||||||
|
}
|
||||||
if (retry < STUN_MAX_RETRIES) {
|
if (retry < STUN_MAX_RETRIES) {
|
||||||
ast_log(LOG_NOTICE,
|
ast_log(LOG_NOTICE,
|
||||||
"Attempt %d to send STUN request to '%s' timed out.",
|
"Attempt %d to send STUN request %stimed out.\n",
|
||||||
retry,
|
retry,
|
||||||
ast_inet_ntoa(dst->sin_addr));
|
stun_destination);
|
||||||
} else {
|
} else {
|
||||||
ast_log(LOG_WARNING,
|
ast_log(LOG_WARNING,
|
||||||
"Attempt %d to send STUN request to '%s' timed out."
|
"Attempt %d to send STUN request %stimed out. "
|
||||||
"Check that the server address is correct and reachable.\n",
|
"Check that the server address is correct and reachable.\n",
|
||||||
retry,
|
retry,
|
||||||
ast_inet_ntoa(dst->sin_addr));
|
stun_destination);
|
||||||
|
}
|
||||||
|
if (dst) {
|
||||||
|
ast_free(stun_destination);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user