mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
verity: fix strncpy boundary check compiler warning
lib/verity/verity.c: In function ‘VERITY_write_sb’: lib/verity/verity.c:200:2: warning: ‘strncpy’ specified bound 32 equals destination size [-Wstringop-truncation] strncpy(algorithm, params->hash_name, sizeof(sb.algorithm));
This commit is contained in:
@@ -197,7 +197,7 @@ int VERITY_write_sb(struct crypt_device *cd,
|
||||
|
||||
/* Kernel always use lower-case */
|
||||
algorithm = (char *)sb.algorithm;
|
||||
strncpy(algorithm, params->hash_name, sizeof(sb.algorithm));
|
||||
strncpy(algorithm, params->hash_name, sizeof(sb.algorithm)-1);
|
||||
algorithm[sizeof(sb.algorithm)-1] = '\0';
|
||||
_to_lower(algorithm);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user