[asterisk-commits] mmichelson: branch 1.6.0 r254540 - /branches/1.6.0/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 25 12:05:43 CDT 2010


Author: mmichelson
Date: Thu Mar 25 12:05:40 2010
New Revision: 254540

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=254540
Log:
Fix crashes resulting from reading non-existent RTP streams.

Specifically, when using the CHANNEL dialplan function, it was
possible to crash Asterisk by trying to get the rtpdest of a
stream type that is not in use by the channel. This commit
fixes that issue.


Modified:
    branches/1.6.0/channels/chan_sip.c

Modified: branches/1.6.0/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.0/channels/chan_sip.c?view=diff&rev=254540&r1=254539&r2=254540
==============================================================================
--- branches/1.6.0/channels/chan_sip.c (original)
+++ branches/1.6.0/channels/chan_sip.c Thu Mar 25 12:05:40 2010
@@ -19064,17 +19064,24 @@
 
 	if (!strcasecmp(args.param, "rtpdest")) {
 		struct sockaddr_in sin;
+		struct ast_rtp *stream;
 
 		if (ast_strlen_zero(args.type))
 			args.type = "audio";
 
-		if (!strcasecmp(args.type, "audio"))
-			ast_rtp_get_peer(p->rtp, &sin);
-		else if (!strcasecmp(args.type, "video"))
-			ast_rtp_get_peer(p->vrtp, &sin);
-		else if (!strcasecmp(args.type, "text"))
-			ast_rtp_get_peer(p->trtp, &sin);
-
+		if (!strcasecmp(args.type, "audio")) {
+			stream = p->rtp;
+		} else if (!strcasecmp(args.type, "video")) {
+			stream = p->vrtp;
+		} else if (!strcasecmp(args.type, "text")) {
+			stream = p->trtp;
+		}
+
+		if (!stream) {
+			return -1;
+		}
+
+		ast_rtp_get_peer(stream, &sin);
 		snprintf(buf, buflen, "%s:%d", ast_inet_ntoa(sin.sin_addr), ntohs(sin.sin_port));
 	} else if (!strcasecmp(args.param, "rtpqos")) {
 		struct ast_rtp_quality qos;




More information about the asterisk-commits mailing list