Check for bad device-mapper name early

There is no need to unlock keyslot if the provided name
has wrong format. Let's check for length and '/' in name early.

Note that other commands could accept path to the device
as libdevmapper translate it to the name (status /dev/mapper/xxx).
Add early check only to activate commands.

It still can fail later because of mangled characters.

Fixes: #893
This commit is contained in:
Milan Broz
2024-07-15 14:07:17 +02:00
parent 624b7087b0
commit 021e5c31fd
10 changed files with 73 additions and 0 deletions

View File

@@ -49,6 +49,7 @@
#define DEFAULT_MEM_ALIGNMENT 4096
#define DM_UUID_LEN 129
#define DM_NAME_LEN 128
#define DM_BY_ID_PREFIX "dm-uuid-"
#define DM_BY_ID_PREFIX_LEN 8
#define DM_UUID_PREFIX "CRYPT-"