summaryrefslogtreecommitdiff
path: root/src/libudev/libudev-util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libudev/libudev-util.c')
-rw-r--r--src/libudev/libudev-util.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libudev/libudev-util.c b/src/libudev/libudev-util.c
index 0ca86c815d..ac906bfec4 100644
--- a/src/libudev/libudev-util.c
+++ b/src/libudev/libudev-util.c
@@ -670,17 +670,18 @@ static unsigned int murmur_hash2(const char *key, int len, unsigned int seed)
/* mix 4 bytes at a time into the hash */
const unsigned char * data = (const unsigned char *)key;
- while(len >= 4) {
- unsigned int k = *(unsigned int *)data;
+ while(len >= sizeof(unsigned int)) {
+ unsigned int k;
+ memcpy(&k, data, sizeof(k));
k *= m;
k ^= k >> r;
k *= m;
h *= m;
h ^= k;
- data += 4;
- len -= 4;
+ data += sizeof(k);
+ len -= sizeof(k);
}
/* handle the last few bytes of the input array */