diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index 12e602f52..6e74c4e83 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.02.03 - ============================ + Fix hash function to avoid using a negative array offset. Don't inline _find in hash.c and tidy signed/unsigned etc. Fix libdevmapper.h #endif. Fix dmsetup version driver version. diff --git a/libdm/datastruct/hash.c b/libdm/datastruct/hash.c index f98689367..1a3ea8167 100644 --- a/libdm/datastruct/hash.c +++ b/libdm/datastruct/hash.c @@ -68,14 +68,14 @@ static struct dm_hash_node *_create_node(const char *str, unsigned len) return n; } -static unsigned long _hash(const char *str, unsigned len) +static unsigned long _hash(const unsigned char *str, unsigned len) { unsigned long h = 0, g; unsigned i; for (i = 0; i < len; i++) { h <<= 4; - h += _nums[(int) *str++]; + h += _nums[*str++]; g = h & ((unsigned long) 0xf << 16u); if (g) { h ^= g >> 16u;