From e9087175a2a5a8ce5ba8ad3631b5e71ffa005066 Mon Sep 17 00:00:00 2001 From: Uli Heilmeier Date: Mon, 12 Oct 2020 11:25:32 +0200 Subject: [PATCH] cmdhflegic: Make sure to show help text Show usage when parameter h is used or none parameter --- client/src/cmdhflegic.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/client/src/cmdhflegic.c b/client/src/cmdhflegic.c index 481d1f1bc..39a542cc9 100644 --- a/client/src/cmdhflegic.c +++ b/client/src/cmdhflegic.c @@ -629,6 +629,10 @@ static int CmdLegicWrbl(const char *Cmd) { while (param_getchar(Cmd, cmdp) != 0x00 && !errors) { switch (tolower(param_getchar(Cmd, cmdp))) { + case 'h': { + errors = true; + break; + } case 'd': { // peek at length of the input string so we can // figure out how many elements to malloc in "data" @@ -679,10 +683,6 @@ static int CmdLegicWrbl(const char *Cmd) { cmdp += 2; break; } - case 'h': { - errors = true; - break; - } case 'y': { autoconfirm = true; break; @@ -695,6 +695,13 @@ static int CmdLegicWrbl(const char *Cmd) { } } + //Validations + if (errors || cmdp == 0) { + if (data) + free(data); + return usage_legic_wrbl(); + } + // OUT-OF-BOUNDS checks // UID 4+1 bytes can't be written to. if (offset < 5) { @@ -704,13 +711,6 @@ static int CmdLegicWrbl(const char *Cmd) { return PM3_EOUTOFBOUND; } - //Validations - if (errors || cmdp == 0) { - if (data) - free(data); - return usage_legic_wrbl(); - } - // tagtype legic_card_select_t card; if (legic_get_type(&card) != PM3_SUCCESS) {