[asterisk-commits] kmoore: branch 1.8 r401537 - /branches/1.8/channels/chan_mgcp.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Oct 23 10:19:59 CDT 2013


Author: kmoore
Date: Wed Oct 23 10:19:56 2013
New Revision: 401537

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=401537
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)

Modified:
    branches/1.8/channels/chan_mgcp.c

Modified: branches/1.8/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_mgcp.c?view=diff&rev=401537&r1=401536&r2=401537
==============================================================================
--- branches/1.8/channels/chan_mgcp.c (original)
+++ branches/1.8/channels/chan_mgcp.c Wed Oct 23 10:19:56 2013
@@ -1958,7 +1958,7 @@
 	char *c;
 	char *a;
 	char host[258];
-	int len;
+	int len = 0;
 	int portno;
 	format_t peercapability;
 	int peerNonCodecCapability;
@@ -1988,8 +1988,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