[asterisk-commits] tilghman: branch 1.2 r56684 - /branches/1.2/channel.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Feb 25 07:38:04 MST 2007


Author: tilghman
Date: Sun Feb 25 08:38:03 2007
New Revision: 56684

URL: http://svn.digium.com/view/asterisk?view=rev&rev=56684
Log:
Issue 9130 - If prev is the last item on the channel list, then evaluating
additional conditions (e.g. name prefix) will cause a NULL dereference.

Modified:
    branches/1.2/channel.c

Modified: branches/1.2/channel.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channel.c?view=diff&rev=56684&r1=56683&r2=56684
==============================================================================
--- branches/1.2/channel.c (original)
+++ branches/1.2/channel.c Sun Feb 25 08:38:03 2007
@@ -747,7 +747,11 @@
 				if (c != prev)	/* not this one */
 					continue;
 				/* found, prepare to return c->next */
-				c = c->next;
+				if ((c = c->next) == NULL) break;
+				/* If prev was the last item on the channel list, then we just
+				 * want to return NULL, instead of trying to deref NULL in the
+				 * next section.
+				 */
 			}
 			if (name) { /* want match by name */
 				if ((!namelen && strcasecmp(c->name, name)) ||



More information about the asterisk-commits mailing list