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.
pull/15486/head
Victor Julien 2 months ago
parent 781bd5184e
commit 736f50600f

@ -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;

Loading…
Cancel
Save