aboutsummaryrefslogtreecommitdiffstats
path: root/channel.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-02-25 14:38:03 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-02-25 14:38:03 +0000
commitb40f9ac39fb2e5c5519a3d348c6405d312a37a34 (patch)
tree70f36f4f08d9a9ba6f68f096c54336475f4caa97 /channel.c
parent8ff7033a0cafd85a44780c77fb3a85986bdb7176 (diff)
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. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@56684 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channel.c')
-rw-r--r--channel.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/channel.c b/channel.c
index 82758b3d4..c218c437e 100644
--- a/channel.c
+++ b/channel.c
@@ -747,7 +747,11 @@ static struct ast_channel *channel_find_locked(const struct ast_channel *prev,
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)) ||