[PATCH] check keyIndex before actually using it as array index

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Ludwig Nussel <ludwig.nussel@xxxxxxx>
---
 luks/keymanage.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/luks/keymanage.c b/luks/keymanage.c
index e45bb61..912e75c 100644
--- a/luks/keymanage.c
+++ b/luks/keymanage.c
@@ -422,7 +422,7 @@ int LUKS_del_key(const char *device, unsigned int keyIndex)
 	r = LUKS_read_phdr(device, &hdr);
 	if(r != 0) {
 		/* placeholder */
-	} else if(hdr.keyblock[keyIndex].active != LUKS_KEY_ENABLED || keyIndex >= LUKS_NUMKEYS) {
+	} else if(keyIndex >= LUKS_NUMKEYS || hdr.keyblock[keyIndex].active != LUKS_KEY_ENABLED) {
 		set_error(_("Key %d not active. Can't wipe.\n"), keyIndex);
 		r = -1;
 	} else {
-- 
1.5.3.4


---------------------------------------------------------------------
dm-crypt mailing list - http://www.saout.de/misc/dm-crypt/
To unsubscribe, e-mail: dm-crypt-unsubscribe@xxxxxxxx
For additional commands, e-mail: dm-crypt-help@xxxxxxxx


[Index of Archives]     [Device Mapper Devel]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux