Wipe buffers to be sure padding is always empty.

Detected by valgrind as writing unitialized data.
This commit is contained in:
Milan Broz
2022-11-27 23:18:36 +01:00
parent 32344d5a84
commit 487e85fdec
2 changed files with 2 additions and 0 deletions

View File

@@ -236,6 +236,7 @@ int LUKS_hdr_backup(const char *backup_file, struct crypt_device *ctx)
r = -ENOMEM;
goto out;
}
memset(buffer, 0, buffer_size);
log_dbg(ctx, "Storing backup of header (%zu bytes) and keyslot area (%zu bytes).",
sizeof(hdr), hdr_size - LUKS_ALIGN_KEYSLOTS);

View File

@@ -47,6 +47,7 @@ int crypt_benchmark(struct crypt_device *cd,
r = -ENOMEM;
if (posix_memalign(&buffer, crypt_getpagesize(), buffer_size))
goto out;
memset(buffer, 0, buffer_size);
r = crypt_cipher_ivsize(cipher, cipher_mode);
if (r >= 0 && iv_size != (size_t)r) {