From 736f50600fd52922844f1957e8ef229b21febb98 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Fri, 29 May 2026 12:40:18 +0200 Subject: [PATCH] mpm/hs: fix compile warnings CC util-mpm-hs-cache.o util-mpm-hs-cache.c:301:59: error: implicit conversion loses integer precision: '__size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32] 301 | SCSha256Update(hasher, (const uint8_t *)ref_info, strlen(ref_info)); | ~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~ util-mpm-hs-cache.c:310:46: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') [-Werror,-Wshorten-64-to-32] 310 | if (!SCSha256FinalizeToHex(hasher, hash, hash_len)) { | ~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~ 2 errors generated. --- src/util-mpm-hs-cache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util-mpm-hs-cache.c b/src/util-mpm-hs-cache.c index ca736166b1..0ba2f3c9a4 100644 --- a/src/util-mpm-hs-cache.c +++ b/src/util-mpm-hs-cache.c @@ -298,7 +298,7 @@ int HSHashDb(const PatternDatabase *pd, char *hash, size_t hash_len) SCMutexLock(&g_hs_ref_info_mutex); const char *ref_info = HSGetReferenceDbInfo(); if (ref_info != NULL) { - SCSha256Update(hasher, (const uint8_t *)ref_info, strlen(ref_info)); + SCSha256Update(hasher, (const uint8_t *)ref_info, (uint32_t)strlen(ref_info)); } SCMutexUnlock(&g_hs_ref_info_mutex); @@ -307,7 +307,7 @@ int HSHashDb(const PatternDatabase *pd, char *hash, size_t hash_len) SCHSCachePatternHash(pd->parray[i], hasher); } - if (!SCSha256FinalizeToHex(hasher, hash, hash_len)) { + if (!SCSha256FinalizeToHex(hasher, hash, (uint32_t)hash_len)) { hasher = NULL; SCLogDebug("sha256 hashing failed"); return -1;