]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix crashes in res_pjsip_sdp_rtp and res_pjsip_t38 when a stream is rejected and...
authorJoshua Colp <jcolp@digium.com>
Thu, 3 Oct 2013 14:51:41 +0000 (14:51 +0000)
committerJoshua Colp <jcolp@digium.com>
Thu, 3 Oct 2013 14:51:41 +0000 (14:51 +0000)
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

res/res_pjsip_sdp_rtp.c
res/res_pjsip_t38.c

index 1d811a15b90472a0a2874dee55657610ddc6af3b..a2dda373fb0da46f21a3bfceb74cb015ebae447c 100644 (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);
 
index 285e9015e6da8f55bec659c4e5232d61a20c7499..e44820214c701bf7cabd920a7bd159fbfa6395df 100644 (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);