]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Ensure the result of the hash function is positive. Negative array offsets suck.
authorTilghman Lesher <tilghman@meg.abyt.es>
Fri, 2 Oct 2009 16:58:03 +0000 (16:58 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Fri, 2 Oct 2009 16:58:03 +0000 (16:58 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@221970 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/astobj2.c

index 89839aadcc1e84719949d0088ced9686f87964ca..e7ec2de91775b0a8bc06d4ed634b700c49eb08f4 100644 (file)
@@ -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;