Commit cba1ebe6 authored by Arie Peterson's avatar Arie Peterson 🐚
Browse files

Check for invalid keyslot in keyslot_only_active

parent 1a90e355
......@@ -21,8 +21,17 @@ char * keyslot_only_active(struct crypt_device * cd, const int keyslot,
for (i = 0; i < keyslot_max; i++)
{
// If it's not the given one, check if it's active.
if (i != keyslot && crypt_keyslot_status(cd, i) != CRYPT_SLOT_INACTIVE)
crypt_keyslot_info s = crypt_keyslot_status(cd, i);
if (s == CRYPT_SLOT_INVALID)
{
char * error;
asprintf(&error, "crypt_keyslot_info: invalid keyslot %d", i);
return error;
}
if (i != keyslot && (s == CRYPT_SLOT_ACTIVE || s == CRYPT_SLOT_ACTIVE_LAST))
{
// We found a keyslot other than the given one that's active.
*only_active = false;
return NULL;
}
......
Supports Markdown
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