summaryrefslogtreecommitdiff
path: root/main/astobj2_container.c
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2015-04-22 16:17:53 -0400
committerCorey Farrell <git@cfware.com>2015-04-22 19:47:47 -0500
commitc231c85ea4a0a3828097e92661f1691cc5c83014 (patch)
treeef9663974512f7d416314ea6ed56a734dab2abf2 /main/astobj2_container.c
parent0722e11f2686c00ace3de11e1a27ceff03f49ff1 (diff)
Astobj2: Ensure all calls to __adjust_lock pass a valid object.
__adjust_lock doesn't check for invalid objects, and doesn't have an appropriate return value for invalid objects. Most callers of __adjust_lock pass objects that have already been confirmed valid, this change adds checks before the remaining calls. ASTERISK-24997 #close Reported by: Corey Farrell Change-Id: I669100f87937cc3f867cec56a27ae9c01292908f
Diffstat (limited to 'main/astobj2_container.c')
-rw-r--r--main/astobj2_container.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/main/astobj2_container.c b/main/astobj2_container.c
index d0abc7985..07d10b9f9 100644
--- a/main/astobj2_container.c
+++ b/main/astobj2_container.c
@@ -510,6 +510,12 @@ struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags)
void ao2_iterator_restart(struct ao2_iterator *iter)
{
+ if (!is_ao2_object(iter->c)) {
+ ast_log(LOG_ERROR, "Iterator container is not valid.\n");
+ ast_assert(0);
+ return;
+ }
+
/* Release the last container node reference if we have one. */
if (iter->last_node) {
enum ao2_lock_req orig_lock;