Fix crashes in res_pjsip_sdp_rtp and res_pjsip_t38 when a stream is rejected and external_media_address is set.

The callback function for changing the media address in streams wrongly assumes that a connection line
will always be present. This is false as no line is present if a stream has been rejected.

(closes issue ASTERISK-22645)
Reported by: Rusty Newton


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@400360 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Joshua Colp
2013-10-03 14:51:41 +00:00
parent 23cea9e44b
commit 024f9bf283
2 changed files with 10 additions and 0 deletions

View File

@@ -1097,6 +1097,11 @@ static void change_outgoing_sdp_stream_media_address(pjsip_tx_data *tdata, struc
char host[NI_MAXHOST];
struct ast_sockaddr addr = { { 0, } };
/* If the stream has been rejected there will be no connection line */
if (!stream->conn) {
return;
}
ast_copy_pj_str(host, &stream->conn->addr, sizeof(host));
ast_sockaddr_parse(&addr, host, PARSE_PORT_FORBID);

View File

@@ -776,6 +776,11 @@ static void change_outgoing_sdp_stream_media_address(pjsip_tx_data *tdata, struc
char host[NI_MAXHOST];
struct ast_sockaddr addr = { { 0, } };
/* If the stream has been rejected there will be no connection line */
if (!stream->conn) {
return;
}
ast_copy_pj_str(host, &stream->conn->addr, sizeof(host));
ast_sockaddr_parse(&addr, host, PARSE_PORT_FORBID);