From 012b1bc180c7d0c595119c7786aedf30fada19f0 Mon Sep 17 00:00:00 2001 From: Tilghman Lesher Date: Fri, 2 Oct 2009 16:58:03 +0000 Subject: [PATCH] Ensure the result of the hash function is positive. Negative array offsets suck. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@221970 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/astobj2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/astobj2.c b/main/astobj2.c index 89839aadcc..e7ec2de917 100644 --- a/main/astobj2.c +++ b/main/astobj2.c @@ -397,7 +397,7 @@ void *__ao2_link(struct ao2_container *c, void *user_data, int iax2_hack) if (!p) return NULL; - i = c->hash_fn(user_data, OBJ_POINTER); + i = abs(c->hash_fn(user_data, OBJ_POINTER)); ao2_lock(c); i %= c->n_buckets;