[svn-commits] kmoore: branch 11 r373211 - /branches/11/channels/chan_sip.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Sep 20 08:00:14 CDT 2012


Author: kmoore
Date: Thu Sep 20 08:00:09 2012
New Revision: 373211

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=373211
Log:
Correct handling of unknown SDP stream types

When the patch to handle arbitrary SDP stream arrangements went into
Asterisk, it also included an ability to transparently decline unknown
stream types. The scanf calls used were not checked properly causing
this part of the functionality to be broken.

(closes issue ASTERISK-20203)

Modified:
    branches/11/channels/chan_sip.c

Modified: branches/11/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/chan_sip.c?view=diff&rev=373211&r1=373210&r2=373211
==============================================================================
--- branches/11/channels/chan_sip.c (original)
+++ branches/11/channels/chan_sip.c Thu Sep 20 08:00:09 2012
@@ -9868,10 +9868,8 @@
 			}
 		} else {
 			char type[20] = {0,};
-			char *typelen = strchr(m, ' ');
-			if (typelen && typelen - m < 20 &&
-			    ((sscanf(m, "%s %30u/%30u %n", type, &x, &numberofports, &len) == 2 && len > 0) ||
-			     (sscanf(m, "%s %30u %n", type, &x, &len) == 1 && len > 0))) {
+			if ((sscanf(m, "%19s %30u/%30u %n", type, &x, &numberofports, &len) == 3 && len > 0) ||
+			     (sscanf(m, "%19s %30u %n", type, &x, &len) == 2 && len > 0)) {
 				/* produce zero-port m-line since it may be needed later
 				 * length is "m=" + type + " 0 " + remainder + "\0" */
 				if (!(offer->decline_m_line = ast_malloc(2 + strlen(type) + 3 + strlen(m + len) + 1))) {




More information about the svn-commits mailing list