From: Tilghman Lesher Date: Fri, 2 Oct 2009 16:58:03 +0000 (+0000) Subject: Ensure the result of the hash function is positive. Negative array offsets suck. X-Git-Tag: 1.4.27-rc2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=012b1bc180c7d0c595119c7786aedf30fada19f0;p=thirdparty%2Fasterisk.git 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 --- 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;