cryptsetup-reencrypt: internal safeguard against mistakes

This commit is contained in:
Ondrej Kozina
2017-10-30 12:43:02 +01:00
committed by Milan Broz
parent e55f10a8f1
commit 35512f4ee9

View File

@@ -1179,6 +1179,11 @@ static int initialize_context(struct reenc_ctx *rc, const char *device)
rc->log_fd = -1;
if (crypt_keyslot_max(CRYPT_LUKS2) > MAX_SLOT) {
log_dbg("Internal error");
return -EINVAL;
}
if (!(rc->device = strndup(device, PATH_MAX)))
return -ENOMEM;