[asterisk-commits] tilghman: branch 1.6.1 r160325 - in /branches/1.6.1: ./ channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Dec 2 12:03:02 CST 2008


Author: tilghman
Date: Tue Dec  2 12:03:01 2008
New Revision: 160325

URL: http://svn.digium.com/view/asterisk?view=rev&rev=160325
Log:
Merged revisions 160308 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
  r160308 | tilghman | 2008-12-02 11:56:24 -0600 (Tue, 02 Dec 2008) | 17 lines
  
  Merged revisions 160297 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r160297 | tilghman | 2008-12-02 11:42:09 -0600 (Tue, 02 Dec 2008) | 10 lines
    
    When the text does not match exactly (e.g. RTP/SAVP), then the %n conversion
    fails, and the resulting integer is garbage.  Thus, we must initialize the
    integer and check it afterwards for success.
    (closes issue #14000)
     Reported by: folke
     Patches: 
           asterisk-sipbg-sscanf-1.4.22.diff uploaded by folke (license 626)
           asterisk-sipbg-sscanf-1.6.0.1.diff uploaded by folke (license 626)
           asterisk-sipbg-sscanf-trunk-r159896.diff uploaded by folke (license 626)
  ........
................

Modified:
    branches/1.6.1/   (props changed)
    branches/1.6.1/channels/chan_sip.c

Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.1/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/channels/chan_sip.c?view=diff&rev=160325&r1=160324&r2=160325
==============================================================================
--- branches/1.6.1/channels/chan_sip.c (original)
+++ branches/1.6.1/channels/chan_sip.c Tue Dec  2 12:03:01 2008
@@ -6916,8 +6916,9 @@
 		int text = FALSE;
 
 		numberofports = 1;
-		if ((sscanf(m, "audio %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2) ||
-		    (sscanf(m, "audio %d RTP/AVP %n", &x, &len) == 1)) {
+		len = -1;
+		if ((sscanf(m, "audio %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
+		    (sscanf(m, "audio %d RTP/AVP %n", &x, &len) == 1 && len > 0)) {
 			audio = TRUE;
 			numberofmediastreams++;
 			/* Found audio stream in this media definition */
@@ -6932,8 +6933,8 @@
 					ast_verbose("Found RTP audio format %d\n", codec);
 				ast_rtp_set_m_type(newaudiortp, codec);
 			}
-		} else if ((sscanf(m, "video %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2) ||
-		    (sscanf(m, "video %d RTP/AVP %n", &x, &len) == 1)) {
+		} else if ((sscanf(m, "video %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
+		    (sscanf(m, "video %d RTP/AVP %n", &x, &len) == 1 && len >= 0)) {
 			video = TRUE;
 			p->novideo = FALSE;
 			numberofmediastreams++;
@@ -6948,8 +6949,8 @@
 					ast_verbose("Found RTP video format %d\n", codec);
 				ast_rtp_set_m_type(newvideortp, codec);
 			}
-		} else if ((sscanf(m, "text %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2) ||
-		    (sscanf(m, "text %d RTP/AVP %n", &x, &len) == 1)) {
+		} else if ((sscanf(m, "text %d/%d RTP/AVP %n", &x, &numberofports, &len) == 2 && len > 0) ||
+		    (sscanf(m, "text %d RTP/AVP %n", &x, &len) == 1 && len > 0)) {
 			text = TRUE;
 			p->notext = FALSE;
 			numberofmediastreams++;
@@ -6964,8 +6965,8 @@
 					ast_verbose("Found RTP text format %d\n", codec);
 				ast_rtp_set_m_type(newtextrtp, codec);
 			}
-		} else if (p->udptl && ( (sscanf(m, "image %d udptl t38%n", &x, &len) == 1) || 
-		 (sscanf(m, "image %d UDPTL t38%n", &x, &len) == 1) )) {
+		} else if (p->udptl && ( (sscanf(m, "image %d udptl t38%n", &x, &len) == 1 && len > 0) || 
+			(sscanf(m, "image %d UDPTL t38%n", &x, &len) == 1 && len > 0) )) {
 			if (debug)
 				ast_verbose("Got T.38 offer in SDP in dialog %s\n", p->callid);
 			udptlportno = x;




More information about the asterisk-commits mailing list