From ece8a5702a3fa75729da513471dc40f0fda45a47 Mon Sep 17 00:00:00 2001 From: Terry Wilson Date: Mon, 20 Jun 2011 17:34:45 +0000 Subject: Merged revisions 324237 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r324237 | twilson | 2011-06-20 12:33:07 -0500 (Mon, 20 Jun 2011) | 12 lines Ignore media offers with a port of 0 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/trunk@324238 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'channels') diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 4c0e2a66c..70f8d7dc8 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -8789,8 +8789,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")) { @@ -8817,8 +8817,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")) { @@ -8845,8 +8845,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; @@ -8867,8 +8867,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); -- cgit v1.2.3