From e8417bf45e81af895d3870810a85328c053a9464 Mon Sep 17 00:00:00 2001 From: I330716 Date: Tue, 12 Mar 2019 16:48:15 +0200 Subject: [PATCH] hash: Improve flb_hash_add to take key up to key_length Signed-off-by: I330716 --- src/flb_hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/flb_hash.c b/src/flb_hash.c index bf68063a3e2..c5d071dac36 100644 --- a/src/flb_hash.c +++ b/src/flb_hash.c @@ -220,7 +220,7 @@ int flb_hash_add(struct flb_hash *ht, char *key, int key_len, entry->hits = 0; /* Store the key and value as a new memory region */ - entry->key = flb_strdup(key); + entry->key = flb_strndup(key, key_len); entry->key_len = key_len; entry->val = flb_malloc(val_size + 1); if (!entry->val) {