From 836d973abd0c6555333870428f19bfa6b9b2ecf8 Mon Sep 17 00:00:00 2001 From: Vladimir Vasilev <38783428+vlvasilev@users.noreply.github.com> Date: Mon, 15 Apr 2019 07:40:53 +0300 Subject: [PATCH] hash: improve flb_hash_add to take key up to key_length (#1186) 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 fe9d80e9020..0ab5fd5ad31 100644 --- a/src/flb_hash.c +++ b/src/flb_hash.c @@ -225,7 +225,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) {