From c0b42ec1c191f7934d2960efda9047384461ff1f Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Tue, 29 Jan 2013 21:42:14 +0100 Subject: [PATCH] Fix out of bounds access. key.first is a pointer, so we shouldn't use the & operator here. CID 610870 and 610871. Should also fix ticket #9184. At least I cannot reproduce it anymore. --- src/add-ons/kernel/network/protocols/ipv6/ipv6.cpp | 2 +- src/add-ons/kernel/network/protocols/ipv6/multicast.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/add-ons/kernel/network/protocols/ipv6/ipv6.cpp b/src/add-ons/kernel/network/protocols/ipv6/ipv6.cpp index 0a5120fb96..76a5ec5dec 100644 --- a/src/add-ons/kernel/network/protocols/ipv6/ipv6.cpp +++ b/src/add-ons/kernel/network/protocols/ipv6/ipv6.cpp @@ -501,7 +501,7 @@ size_t MulticastStateHash::HashKey(const KeyType &key) const { size_t result = 0; - result = jenkins_hashword((const uint32*)&key.first, + result = jenkins_hashword((const uint32*)key.first, sizeof(in6_addr) / sizeof(uint32), result); result = jenkins_hashword(&key.second, 1, result); return result; diff --git a/src/add-ons/kernel/network/protocols/ipv6/multicast.h b/src/add-ons/kernel/network/protocols/ipv6/multicast.h index 9b3915da5d..4583d205a6 100644 --- a/src/add-ons/kernel/network/protocols/ipv6/multicast.h +++ b/src/add-ons/kernel/network/protocols/ipv6/multicast.h @@ -172,7 +172,7 @@ public: size_t HashKey(const KeyType &key) const { size_t result = 0; - result = jenkins_hashword((const uint32*)&key.first, + result = jenkins_hashword((const uint32*)key.first, sizeof(in6_addr) / sizeof(uint32), result); result = jenkins_hashword(&key.second, 1, result); return result;