summaryrefslogtreecommitdiff
path: root/lib/hash
diff options
context:
space:
mode:
authorConor Fogarty <[email protected]>2023-07-06 16:26:26 +0100
committerDavid Marchand <[email protected]>2024-06-14 15:55:56 +0200
commit8f36e53317ecf8384461e4f692e46beaaf6c4d2f (patch)
treebfab76b09f21b212b2782d801c6194664ce51a7d /lib/hash
parent78a632e6b52c29c5f297001181e870750eee02a7 (diff)
hash: check name when creating a hash
Add NULL pointer check to params->name, which is later copied into the hash datastructure. Without this check the code segfaults on the strlcpy() of a NULL pointer. Fixes: 48a399119619 ("hash: replace with cuckoo hash implementation") Cc: [email protected] Signed-off-by: Conor Fogarty <[email protected]> Acked-by: Vladimir Medvedkin <[email protected]>
Diffstat (limited to 'lib/hash')
-rw-r--r--lib/hash/rte_cuckoo_hash.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/hash/rte_cuckoo_hash.c b/lib/hash/rte_cuckoo_hash.c
index b31a3d973e..16c9c4c5c4 100644
--- a/lib/hash/rte_cuckoo_hash.c
+++ b/lib/hash/rte_cuckoo_hash.c
@@ -173,6 +173,7 @@ rte_hash_create(const struct rte_hash_parameters *params)
/* Check for valid parameters */
if ((params->entries > RTE_HASH_ENTRIES_MAX) ||
(params->entries < RTE_HASH_BUCKET_ENTRIES) ||
+ (params->name == NULL) ||
(params->key_len == 0)) {
rte_errno = EINVAL;
HASH_LOG(ERR, "%s has invalid parameters", __func__);