mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Fix debug message printing LUKS2 checksum.
The trailing NUL is written already by snprintf, moreover, it is written on wrong place here. Just rely on snprintf here. Fixes: #685.
This commit is contained in:
@@ -62,8 +62,8 @@ static void log_dbg_checksum(struct crypt_device *cd,
|
||||
int i;
|
||||
|
||||
for (i = 0; i < crypt_hash_size(csum_alg); i++)
|
||||
snprintf(&csum_txt[i*2], 3, "%02hhx", (const char)csum[i]);
|
||||
csum_txt[i*2+1] = '\0'; /* Just to be safe, sprintf should write \0 there. */
|
||||
if (snprintf(&csum_txt[i*2], 3, "%02hhx", (const char)csum[i]) != 2)
|
||||
return;
|
||||
|
||||
log_dbg(cd, "Checksum:%s (%s)", &csum_txt[0], info);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user