Change the BLOCK_HASH_SIZE type to avoid potential overflow

This commit is contained in:
Andrea Mazzoleni 2026-05-03 22:29:11 +02:00
parent 6b9459346a
commit fd77444254
7 changed files with 13 additions and 12 deletions

View file

@ -138,7 +138,7 @@ struct snapraid_filter {
*
* At max HASH_MAX.
*/
extern int BLOCK_HASH_SIZE;
extern size_t BLOCK_HASH_SIZE;
/**
* Block of a file.
@ -646,7 +646,7 @@ int filter_content(tommy_list* contentlist, const char* path);
*/
static inline int hash_is_invalid(const unsigned char* hash)
{
int i;
size_t i;
/* if the hash is reduced, we cannot grant that it's a specific kind of hash */
if (BLOCK_HASH_SIZE != HASH_MAX)
@ -668,7 +668,7 @@ static inline int hash_is_invalid(const unsigned char* hash)
*/
static inline int hash_is_zero(const unsigned char* hash)
{
int i;
size_t i;
/* if the hash is reduced, we cannot grant that it's a specific kind of hash */
if (BLOCK_HASH_SIZE != HASH_MAX)