From a086754279732bd4c210e5bff5e3404e76368611 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Wed, 8 Apr 2020 05:26:39 +0200 Subject: [PATCH] earlier test --- client/cmdhflegic.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/client/cmdhflegic.c b/client/cmdhflegic.c index 901ec85d0..088800780 100644 --- a/client/cmdhflegic.c +++ b/client/cmdhflegic.c @@ -658,6 +658,14 @@ static int CmdLegicWrbl(const char *Cmd) { } } } + + // OUT-OF-BOUNDS checks + // UID 4+1 bytes can't be written to. + if (offset < 5) { + PrintAndLogEx(WARNING, "Out-of-bounds, bytes 0-1-2-3-4 can't be written to. Offset = %d", offset); + return PM3_EOUTOFBOUND; + } + //Validations if (errors || cmdp == 0) { if (data) @@ -674,13 +682,6 @@ static int CmdLegicWrbl(const char *Cmd) { legic_print_type(card.cardsize, 0); - // OUT-OF-BOUNDS checks - // UID 4+1 bytes can't be written to. - if (offset < 5) { - PrintAndLogEx(WARNING, "Out-of-bounds, bytes 0-1-2-3-4 can't be written to. Offset = %d", offset); - return PM3_EOUTOFBOUND; - } - if (len + offset > card.cardsize) { PrintAndLogEx(WARNING, "Out-of-bounds, Cardsize = %d, [offset+len = %d ]", card.cardsize, len + offset); return PM3_EOUTOFBOUND;