mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-12 03:10:08 +01:00
Fix issues found by Coverity scan.
- possible overflow of data offset calculation in wipe and - dereferencing of pointer in a keyring error path.
This commit is contained in:
@@ -1220,7 +1220,7 @@ int LUKS_wipe_header_areas(struct luks_phdr *hdr,
|
|||||||
|
|
||||||
/* Wipe complete header, keyslots and padding aread with zeroes. */
|
/* Wipe complete header, keyslots and padding aread with zeroes. */
|
||||||
offset = 0;
|
offset = 0;
|
||||||
length = hdr->payloadOffset * SECTOR_SIZE;
|
length = (uint64_t)hdr->payloadOffset * SECTOR_SIZE;
|
||||||
wipe_block = 1024 * 1024;
|
wipe_block = 1024 * 1024;
|
||||||
|
|
||||||
/* On detached header or bogus header, wipe at least the first 4k */
|
/* On detached header or bogus header, wipe at least the first 4k */
|
||||||
|
|||||||
@@ -133,7 +133,8 @@ int keyring_get_passphrase(const char *key_desc,
|
|||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
err = errno;
|
err = errno;
|
||||||
crypt_memzero(buf, len);
|
if (buf)
|
||||||
|
crypt_memzero(buf, len);
|
||||||
free(buf);
|
free(buf);
|
||||||
return -err;
|
return -err;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user