From: Joshua Colp Date: Thu, 3 Oct 2013 14:51:41 +0000 (+0000) Subject: Fix crashes in res_pjsip_sdp_rtp and res_pjsip_t38 when a stream is rejected and... X-Git-Tag: 12.0.0-alpha2~24^2~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=024f9bf283c4c08d95b4bf012b569a96c024de7e;p=thirdparty%2Fasterisk.git 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 --- diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c index 1d811a15b9..a2dda373fb 100644 --- a/res/res_pjsip_sdp_rtp.c +++ b/res/res_pjsip_sdp_rtp.c @@ -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); diff --git a/res/res_pjsip_t38.c b/res/res_pjsip_t38.c index 285e9015e6..e44820214c 100644 --- a/res/res_pjsip_t38.c +++ b/res/res_pjsip_t38.c @@ -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);