Commit 27eaf46c authored by Milan Broz's avatar Milan Broz

Fix issues found by Coverity scan.

- possible overflow of data offset calculation in wipe and
- dereferencing of pointer in a keyring error path.
parent 202aeece
......@@ -1220,7 +1220,7 @@ int LUKS_wipe_header_areas(struct luks_phdr *hdr,
/* Wipe complete header, keyslots and padding aread with zeroes. */
offset = 0;
length = hdr->payloadOffset * SECTOR_SIZE;
length = (uint64_t)hdr->payloadOffset * SECTOR_SIZE;
wipe_block = 1024 * 1024;
/* 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) {
err = errno;
crypt_memzero(buf, len);
if (buf)
crypt_memzero(buf, len);
free(buf);
return -err;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment