[asterisk-commits] kmoore: branch 11 r401538 - in /branches/11: ./	channels/chan_mgcp.c
    SVN commits to the Asterisk project 
    asterisk-commits at lists.digium.com
       
    Wed Oct 23 10:22:56 CDT 2013
    
    
  
Author: kmoore
Date: Wed Oct 23 10:22:54 2013
New Revision: 401538
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=401538
Log:
chan_mgcp: Properly handle malformed media lines
This corrects a situation in which a media line was not parsed properly
and resulted in a crash.
(closes issue ASTERISK-21190)
Reported by: adomjan
Patches:
    chan_mgcp.c-sscnaf_fix uploaded by adomjan (License 5448)
........
Merged revisions 401537 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Modified:
    branches/11/   (props changed)
    branches/11/channels/chan_mgcp.c
Propchange: branches/11/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: branches/11/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/chan_mgcp.c?view=diff&rev=401538&r1=401537&r2=401538
==============================================================================
--- branches/11/channels/chan_mgcp.c (original)
+++ branches/11/channels/chan_mgcp.c Wed Oct 23 10:22:54 2013
@@ -1960,7 +1960,7 @@
 	char *c;
 	char *a;
 	char host[258];
-	int len;
+	int len = 0;
 	int portno;
 	struct ast_format_cap *peercap;
 	int peerNonCodecCapability;
@@ -1990,8 +1990,8 @@
 		ast_log(LOG_WARNING, "Unable to lookup host in c= line, '%s'\n", c);
 		return -1;
 	}
-	if (sscanf(m, "audio %30d RTP/AVP %n", &portno, &len) != 1) {
-		ast_log(LOG_WARNING, "Unable to determine port number for RTP in '%s'\n", m);
+	if (sscanf(m, "audio %30d RTP/AVP %n", &portno, &len) != 1 || !len) {
+		ast_log(LOG_WARNING, "Malformed media stream descriptor: %s\n", m);
 		return -1;
 	}
 	sin.sin_family = AF_INET;
    
    
More information about the asterisk-commits
mailing list