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
........

Merged revisions 400360 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400361 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Joshua Colp
2013-10-03 14:52:24 +00:00
parent addbf276f5
commit c977f73e13
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]; char host[NI_MAXHOST];
struct ast_sockaddr addr = { { 0, } }; 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_copy_pj_str(host, &stream->conn->addr, sizeof(host));
ast_sockaddr_parse(&addr, host, PARSE_PORT_FORBID); 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]; char host[NI_MAXHOST];
struct ast_sockaddr addr = { { 0, } }; 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_copy_pj_str(host, &stream->conn->addr, sizeof(host));
ast_sockaddr_parse(&addr, host, PARSE_PORT_FORBID); ast_sockaddr_parse(&addr, host, PARSE_PORT_FORBID);