[asterisk-commits] tilghman: branch 1.4 r221970 - /branches/1.4/main/astobj2.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Oct 2 11:58:07 CDT 2009


Author: tilghman
Date: Fri Oct  2 11:58:03 2009
New Revision: 221970

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=221970
Log:
Ensure the result of the hash function is positive.  Negative array offsets suck.

Modified:
    branches/1.4/main/astobj2.c

Modified: branches/1.4/main/astobj2.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/main/astobj2.c?view=diff&rev=221970&r1=221969&r2=221970
==============================================================================
--- branches/1.4/main/astobj2.c (original)
+++ branches/1.4/main/astobj2.c Fri Oct  2 11:58:03 2009
@@ -397,7 +397,7 @@
 	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;




More information about the asterisk-commits mailing list