mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-13 20:00:08 +01:00
lib: harden checks for null name in resume/suspend
This commit is contained in:
committed by
Milan Broz
parent
198f1d10c4
commit
10bb186c76
16
lib/setup.c
16
lib/setup.c
@@ -1598,6 +1598,9 @@ int crypt_suspend(struct crypt_device *cd,
|
|||||||
crypt_status_info ci;
|
crypt_status_info ci;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
if (!name)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
log_dbg("Suspending volume %s.", name);
|
log_dbg("Suspending volume %s.", name);
|
||||||
|
|
||||||
if (cd->type) {
|
if (cd->type) {
|
||||||
@@ -1648,15 +1651,15 @@ int crypt_resume_by_passphrase(struct crypt_device *cd,
|
|||||||
struct volume_key *vk = NULL;
|
struct volume_key *vk = NULL;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
log_dbg("Resuming volume %s.", name);
|
|
||||||
|
|
||||||
r = onlyLUKS(cd);
|
r = onlyLUKS(cd);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
if (!passphrase)
|
if (!passphrase || !name)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
log_dbg("Resuming volume %s.", name);
|
||||||
|
|
||||||
r = dm_status_suspended(cd, name);
|
r = dm_status_suspended(cd, name);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
@@ -1694,12 +1697,15 @@ int crypt_resume_by_keyfile_offset(struct crypt_device *cd,
|
|||||||
size_t passphrase_size_read;
|
size_t passphrase_size_read;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
log_dbg("Resuming volume %s.", name);
|
|
||||||
|
|
||||||
r = onlyLUKS(cd);
|
r = onlyLUKS(cd);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
if (!name)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
log_dbg("Resuming volume %s.", name);
|
||||||
|
|
||||||
r = dm_status_suspended(cd, name);
|
r = dm_status_suspended(cd, name);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|||||||
Reference in New Issue
Block a user