[asterisk-commits] rmudgett: branch 1.8 r390044 - /branches/1.8/main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 29 15:10:08 CDT 2013


Author: rmudgett
Date: Wed May 29 15:10:04 2013
New Revision: 390044

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=390044
Log:
Fix segfault when dealing with chan_agent channels.

Check the returned bridged pointer for NULL to avoid a crash.  It looks
like chan_agent is returning a NULL pointer when it probably should be
returning a pointer to the channel the Agent channel is pretending to be.

(closes issue ASTERISK-21793)
Reported by: Rodrigo P. Telles
Patches:
      jira_asterisk_21793_v1.8.patch (license #5621) patch uploaded by rmudgett
Tested by: Rodrigo P. Telles

Modified:
    branches/1.8/main/channel.c

Modified: branches/1.8/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/channel.c?view=diff&rev=390044&r1=390043&r2=390044
==============================================================================
--- branches/1.8/main/channel.c (original)
+++ branches/1.8/main/channel.c Wed May 29 15:10:04 2013
@@ -6350,14 +6350,14 @@
 	linkedid = oldest_linkedid(linkedid, peer->uniqueid);
 	if (chan->_bridge) {
 		bridged = ast_bridged_channel(chan);
-		if (bridged != peer) {
+		if (bridged && bridged != peer) {
 			linkedid = oldest_linkedid(linkedid, bridged->linkedid);
 			linkedid = oldest_linkedid(linkedid, bridged->uniqueid);
 		}
 	}
 	if (peer->_bridge) {
 		bridged = ast_bridged_channel(peer);
-		if (bridged != chan) {
+		if (bridged && bridged != chan) {
 			linkedid = oldest_linkedid(linkedid, bridged->linkedid);
 			linkedid = oldest_linkedid(linkedid, bridged->uniqueid);
 		}
@@ -6370,13 +6370,13 @@
 	ast_channel_change_linkedid(peer, linkedid);
 	if (chan->_bridge) {
 		bridged = ast_bridged_channel(chan);
-		if (bridged != peer) {
+		if (bridged && bridged != peer) {
 			ast_channel_change_linkedid(bridged, linkedid);
 		}
 	}
 	if (peer->_bridge) {
 		bridged = ast_bridged_channel(peer);
-		if (bridged != chan) {
+		if (bridged && bridged != chan) {
 			ast_channel_change_linkedid(bridged, linkedid);
 		}
 	}




More information about the asterisk-commits mailing list