mirror of
https://github.com/OISF/suricata.git
synced 2026-10-11 22:09:53 +00:00
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user