Fails if more device arguments are present for isLuks.

Fixes
http://code.google.com/p/cryptsetup/issues/detail?id=165
This commit is contained in:
Milan Broz
2013-07-27 12:33:22 +02:00
parent cfeaaa02fc
commit d67548adfe

View File

@@ -1010,6 +1010,12 @@ static int action_isLuks(void)
struct crypt_device *cd = NULL; struct crypt_device *cd = NULL;
int r; int r;
/* FIXME: argc > max should be checked for other operations as well */
if (action_argc > 1) {
log_err(_("Only one device argument for isLuks operation is supported.\n"));
return -ENODEV;
}
if ((r = crypt_init(&cd, action_argv[0]))) if ((r = crypt_init(&cd, action_argv[0])))
goto out; goto out;
@@ -1500,7 +1506,7 @@ int main(int argc, const char **argv)
usage(popt_context, EXIT_FAILURE, _("Unknown action."), usage(popt_context, EXIT_FAILURE, _("Unknown action."),
poptGetInvocationName(popt_context)); poptGetInvocationName(popt_context));
if(action_argc < action->required_action_argc) if (action_argc < action->required_action_argc)
help_args(action, popt_context); help_args(action, popt_context);
/* FIXME: rewrite this from scratch */ /* FIXME: rewrite this from scratch */