From e343e37eb68304e4b3ed2dad3d0880c711109f20 Mon Sep 17 00:00:00 2001 From: falsycat Date: Sun, 12 May 2024 13:02:00 +0900 Subject: [PATCH] use str util to compare string --- core/exec/idea.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/exec/idea.h b/core/exec/idea.h index f8bc68a..afea268 100644 --- a/core/exec/idea.h +++ b/core/exec/idea.h @@ -6,6 +6,7 @@ #include #include "util/buffer.h" +#include "util/str.h" #include "core/exec/mod.h" @@ -35,11 +36,11 @@ static inline bool nf7core_exec_idea_register( static inline const struct nf7core_exec_idea* nf7core_exec_idea_find( const struct nf7core_exec* mod, const uint8_t* name, size_t namelen) { assert(nullptr != mod); - assert(nullptr != name); + assert(nullptr != name || 0U == namelen); for (uint32_t i = 0; i < mod->ideas.n; ++i) { const struct nf7core_exec_idea* idea = mod->ideas.ptr[i]; - if (0 == strncmp((const char*) idea->name, (const char*) name, namelen)) { + if (nf7util_str_equal_cstr(name, namelen, idea->name)) { return idea; } }