summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/basic/hashmap.c2
-rw-r--r--src/libsystemd-network/sd-dhcp-server.c1
-rw-r--r--src/libsystemd-network/sd-lldp.c1
-rw-r--r--src/libsystemd/sd-bus/busctl.c5
-rw-r--r--src/shared/dns-domain.c6
5 files changed, 14 insertions, 1 deletions
diff --git a/src/basic/hashmap.c b/src/basic/hashmap.c
index 3c05bee56d..3e17ed30df 100644
--- a/src/basic/hashmap.c
+++ b/src/basic/hashmap.c
@@ -277,7 +277,7 @@ static const struct hashmap_type_info hashmap_type_info[_HASHMAP_TYPE_MAX] = {
};
void string_hash_func(const void *p, struct siphash *state) {
- siphash24_compress(p, strlen(p), state);
+ siphash24_compress(p, strlen(p) + 1, state);
}
int string_compare_func(const void *a, const void *b) {
diff --git a/src/libsystemd-network/sd-dhcp-server.c b/src/libsystemd-network/sd-dhcp-server.c
index 4ea5a29e5c..d941e6c0de 100644
--- a/src/libsystemd-network/sd-dhcp-server.c
+++ b/src/libsystemd-network/sd-dhcp-server.c
@@ -117,6 +117,7 @@ void client_id_hash_func(const void *p, struct siphash *state) {
assert(id->length);
assert(id->data);
+ siphash24_compress(&id->length, sizeof(id->length), state);
siphash24_compress(id->data, id->length, state);
}
diff --git a/src/libsystemd-network/sd-lldp.c b/src/libsystemd-network/sd-lldp.c
index b9bf4d3c00..0b7d35cdf1 100644
--- a/src/libsystemd-network/sd-lldp.c
+++ b/src/libsystemd-network/sd-lldp.c
@@ -74,6 +74,7 @@ static void chassis_id_hash_func(const void *p, struct siphash *state) {
assert(id);
assert(id->data);
+ siphash24_compress(&id->length, sizeof(id->length), state);
siphash24_compress(id->data, id->length, state);
}
diff --git a/src/libsystemd/sd-bus/busctl.c b/src/libsystemd/sd-bus/busctl.c
index 496b9a7b4e..49c97af339 100644
--- a/src/libsystemd/sd-bus/busctl.c
+++ b/src/libsystemd/sd-bus/busctl.c
@@ -630,12 +630,17 @@ typedef struct Member {
static void member_hash_func(const void *p, struct siphash *state) {
const Member *m = p;
+ uint64_t arity = 1;
assert(m);
assert(m->type);
string_hash_func(m->type, state);
+ arity += !!m->name + !!m->interface;
+
+ uint64_hash_func(&arity, state);
+
if (m->name)
string_hash_func(m->name, state);
diff --git a/src/shared/dns-domain.c b/src/shared/dns-domain.c
index 1517443736..5680f01bd9 100644
--- a/src/shared/dns-domain.c
+++ b/src/shared/dns-domain.c
@@ -399,11 +399,17 @@ void dns_name_hash_func(const void *s, struct siphash *state) {
if (k > 0)
r = k;
+ if (r == 0)
+ break;
+
label[r] = 0;
ascii_strlower(label);
string_hash_func(label, state);
}
+
+ /* enforce that all names are terminated by the empty label */
+ string_hash_func("", state);
}
int dns_name_compare_func(const void *a, const void *b) {