hf mfu otptear -m fix

This commit is contained in:
iceman1001 2020-10-12 01:55:39 +02:00
commit b64742baf9

View file

@ -2819,7 +2819,7 @@ static int CmdHF14AMfUPwdGen(const char *Cmd) {
static int CmdHF14AMfuOtpTearoff(const char *Cmd) { static int CmdHF14AMfuOtpTearoff(const char *Cmd) {
uint8_t blockNoUint = 8; uint8_t blockNoUint = 8;
uint8_t cmdp = 0; uint8_t cmdp = 0;
bool errors = 0; bool errors = 0, use_match = false;
uint8_t match[4] = {0x00}; uint8_t match[4] = {0x00};
uint8_t teardata[8] = {0x00}; uint8_t teardata[8] = {0x00};
uint32_t interval = 500; // time in us uint32_t interval = 500; // time in us
@ -2879,6 +2879,7 @@ static int CmdHF14AMfuOtpTearoff(const char *Cmd) {
case 'm': case 'm':
if (param_gethex(Cmd, cmdp + 1, match, 8)) { if (param_gethex(Cmd, cmdp + 1, match, 8)) {
PrintAndLogEx(WARNING, "Block data must include 8 HEX symbols"); PrintAndLogEx(WARNING, "Block data must include 8 HEX symbols");
use_match = true;
errors = true; errors = true;
} }
cmdp += 2; cmdp += 2;
@ -2986,7 +2987,7 @@ static int CmdHF14AMfuOtpTearoff(const char *Cmd) {
} }
} }
if (memcmp(pre, match, sizeof(pre)) == 0) { if (use_match && memcmp(pre, match, sizeof(pre)) == 0) {
PrintAndLogEx(SUCCESS, "Block matches!\n"); PrintAndLogEx(SUCCESS, "Block matches!\n");
break; break;
} }