summaryrefslogtreecommitdiff
path: root/src/basic/hashmap.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-10-04 01:59:06 +0200
committerTom Gundersen <teg@jklm.no>2015-10-05 19:21:02 +0200
commit1e2527a6fede996a429bd44b30a15e76ee293437 (patch)
tree3cfdbc2314a6b3c26b63807e5575dac906734942 /src/basic/hashmap.c
parentb826ab586c9e0a9c0d438a75c28cf3a8ab485929 (diff)
hashmap: hash_funcs - make inputs unambiguous
Make sure all variable-length inputs are properly terminated or that their length is encoded in some way. This avoids ambiguity of adjacent inputs. E.g., in case of a hash function taking two strings, compressing "ab" followed by "c" is now distinct from "a" followed by "bc".
Diffstat (limited to 'src/basic/hashmap.c')
-rw-r--r--src/basic/hashmap.c2
1 files changed, 1 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) {