]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Ignore media offers with a port of 0
authorTerry Wilson <twilson@digium.com>
Mon, 20 Jun 2011 17:33:07 +0000 (17:33 +0000)
committerTerry Wilson <twilson@digium.com>
Mon, 20 Jun 2011 17:33:07 +0000 (17:33 +0000)
Section 5.1 of RFC3264 states:
  A port number of zero in the offer indicates that the stream is offered
  but MUST NOT be used.

(closes issue ASTERISK-17845)
Reported by: jacco
Patches:
      issue19281_2.patch uploaded by jacco (license 1277)
Tested by: jacco, twilson

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

channels/chan_sip.c

index b756a1810eede41a84c3fdb9da58b14b62dd7cf2..1170a3471ad7d287a017b3e4b7b37e13c8ad485f 100644 (file)
@@ -8612,8 +8612,8 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
                nextm = get_sdp_iterate(&next, req, "m");
 
                /* Search for audio media definition */
-               if ((sscanf(m, "audio %30u/%30u RTP/%4s %n", &x, &numberofports, protocol, &len) == 3 && len > 0) ||
-                   (sscanf(m, "audio %30u RTP/%4s %n", &x, protocol, &len) == 2 && len > 0)) {
+               if ((sscanf(m, "audio %30u/%30u RTP/%4s %n", &x, &numberofports, protocol, &len) == 3 && len > 0 && x) ||
+                   (sscanf(m, "audio %30u RTP/%4s %n", &x, protocol, &len) == 2 && len > 0 && x)) {
                        if (!strcmp(protocol, "SAVP")) {
                                secure_audio = 1;
                        } else if (strcmp(protocol, "AVP")) {
@@ -8639,8 +8639,8 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
                                ast_rtp_codecs_payloads_set_m_type(&newaudiortp, NULL, codec);
                        }
                /* Search for video media definition */
-               } else if ((sscanf(m, "video %30u/%30u RTP/%4s %n", &x, &numberofports, protocol, &len) == 3 && len > 0) ||
-                          (sscanf(m, "video %30u RTP/%4s %n", &x, protocol, &len) == 2 && len >= 0)) {
+               } else if ((sscanf(m, "video %30u/%30u RTP/%4s %n", &x, &numberofports, protocol, &len) == 3 && len > 0 && x) ||
+                          (sscanf(m, "video %30u RTP/%4s %n", &x, protocol, &len) == 2 && len >= 0 && x)) {
                        if (!strcmp(protocol, "SAVP")) {
                                secure_video = 1;
                        } else if (strcmp(protocol, "AVP")) {
@@ -8666,8 +8666,8 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
                                ast_rtp_codecs_payloads_set_m_type(&newvideortp, NULL, codec);
                        }
                /* Search for text media definition */
-               } else if ((sscanf(m, "text %30u/%30u RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
-                          (sscanf(m, "text %30u RTP/AVP %n", &x, &len) == 1 && len > 0)) {
+               } else if ((sscanf(m, "text %30u/%30u RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0 && x) ||
+                          (sscanf(m, "text %30u RTP/AVP %n", &x, &len) == 1 && len > 0 && x)) {
                        text = TRUE;
                        p->notext = FALSE;
                        p->offered_media[SDP_TEXT].offered = TRUE;
@@ -8687,8 +8687,8 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
                                ast_rtp_codecs_payloads_set_m_type(&newtextrtp, NULL, codec);
                        }
                /* Search for image media definition */
-               } else if (p->udptl && ((sscanf(m, "image %30u udptl t38%n", &x, &len) == 1 && len > 0) ||
-                                       (sscanf(m, "image %30u UDPTL t38%n", &x, &len) == 1 && len > 0) )) {
+               } else if (p->udptl && ((sscanf(m, "image %30u udptl t38%n", &x, &len) == 1 && len > 0 && x) ||
+                                       (sscanf(m, "image %30u UDPTL t38%n", &x, &len) == 1 && len > 0 && x) )) {
                        image = TRUE;
                        if (debug)
                                ast_verbose("Got T.38 offer in SDP in dialog %s\n", p->callid);