]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
AST-2013-005: Fix crash caused by invalid SDP
authorMatthew Jordan <mjordan@digium.com>
Tue, 27 Aug 2013 18:13:22 +0000 (18:13 +0000)
committerMatthew Jordan <mjordan@digium.com>
Tue, 27 Aug 2013 18:13:22 +0000 (18:13 +0000)
If the SIP channel driver processes an invalid SDP that defines media
descriptions before connection information, it may attempt to reference
the socket address information even though that information has not yet
been set. This will cause a crash.

This patch adds checks when handling the various media descriptions that
ensures the media descriptions are handled only if we have connection
information suitable for that media.

Thanks to Walter Doekes, OSSO B.V., for reporting, testing, and providing
the solution to this problem.

(closes issue ASTERISK-22007)
Reported by: wdoekes
Tested by: wdoekes
patches:
  issueA22007_sdp_without_c_death.patch uploaded by wdoekes (License 5674)
........

Merged revisions 397756 from http://svn.asterisk.org/svn/asterisk/branches/1.8

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.15@397761 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 3cc965eee4d0f8925929fdebad34e11dea56cc70..cd94b2a0d4fb67fe790ce27bd680b17123aae9a5 100644 (file)
@@ -9419,7 +9419,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
 
        /* Setup audio address and port */
        if (p->rtp) {
-               if (portno > 0) {
+               if (sa && portno > 0) {
                        ast_sockaddr_set_port(sa, portno);
                        ast_rtp_instance_set_remote_address(p->rtp, sa);
                        if (debug) {
@@ -9466,7 +9466,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
 
        /* Setup video address and port */
        if (p->vrtp) {
-               if (vportno > 0) {
+               if (vsa && vportno > 0) {
                        ast_sockaddr_set_port(vsa, vportno);
                        ast_rtp_instance_set_remote_address(p->vrtp, vsa);
                        if (debug) {
@@ -9483,7 +9483,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
 
        /* Setup text address and port */
        if (p->trtp) {
-               if (tportno > 0) {
+               if (tsa && tportno > 0) {
                        ast_sockaddr_set_port(tsa, tportno);
                        ast_rtp_instance_set_remote_address(p->trtp, tsa);
                        if (debug) {
@@ -9506,7 +9506,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
 
        /* Setup image address and port */
        if (p->udptl) {
-               if (udptlportno > 0) {
+               if (isa && udptlportno > 0) {
                        if (ast_test_flag(&p->flags[1], SIP_PAGE2_SYMMETRICRTP) && ast_test_flag(&p->flags[1], SIP_PAGE2_UDPTL_DESTINATION)) {
                                ast_rtp_instance_get_remote_address(p->rtp, isa);
                                if (!ast_sockaddr_isnull(isa) && debug) {