summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2007-02-25 14:53:40 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2007-02-25 14:53:40 +0000
commitb0f60e7496692b384cd1009e6ef3f6c915136989 (patch)
tree42317a123c4479829c94a1329774d79f612cc031
parent75d387acbc19d236e8417b09ea6a53f6e4e45217 (diff)
Merged revisions 56685 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r56685 | tilghman | 2007-02-25 08:46:41 -0600 (Sun, 25 Feb 2007) | 11 lines Merged revisions 56684 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r56684 | tilghman | 2007-02-25 08:38:03 -0600 (Sun, 25 Feb 2007) | 3 lines 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: https://origsvn.digium.com/svn/asterisk/trunk@56686 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--main/channel.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/main/channel.c b/main/channel.c
index a18251d84..4cd7f35bc 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -906,7 +906,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 = AST_LIST_NEXT(c, chan_list);
+ if ((c = AST_LIST_NEXT(c, chan_list)) == 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)) ||