mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-12 19:30:04 +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;
|
||||
int r;
|
||||
|
||||
if (!name)
|
||||
return -EINVAL;
|
||||
|
||||
log_dbg("Suspending volume %s.", name);
|
||||
|
||||
if (cd->type) {
|
||||
@@ -1648,15 +1651,15 @@ int crypt_resume_by_passphrase(struct crypt_device *cd,
|
||||
struct volume_key *vk = NULL;
|
||||
int r;
|
||||
|
||||
log_dbg("Resuming volume %s.", name);
|
||||
|
||||
r = onlyLUKS(cd);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (!passphrase)
|
||||
if (!passphrase || !name)
|
||||
return -EINVAL;
|
||||
|
||||
log_dbg("Resuming volume %s.", name);
|
||||
|
||||
r = dm_status_suspended(cd, name);
|
||||
if (r < 0)
|
||||
return r;
|
||||
@@ -1694,12 +1697,15 @@ int crypt_resume_by_keyfile_offset(struct crypt_device *cd,
|
||||
size_t passphrase_size_read;
|
||||
int r;
|
||||
|
||||
log_dbg("Resuming volume %s.", name);
|
||||
|
||||
r = onlyLUKS(cd);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (!name)
|
||||
return -EINVAL;
|
||||
|
||||
log_dbg("Resuming volume %s.", name);
|
||||
|
||||
r = dm_status_suspended(cd, name);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
Reference in New Issue
Block a user