From 4aa8645a33f511afed3d93b96571cad548ea78e9 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 14 May 2024 12:00:19 +0200 Subject: [PATCH] fixed order of checking --- client/src/cmdhf15.c | 27 +++++++++++++++------------ client/src/cmdhfntag424.c | 1 + 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/client/src/cmdhf15.c b/client/src/cmdhf15.c index 914a1b58b..4dd9231ad 100644 --- a/client/src/cmdhf15.c +++ b/client/src/cmdhf15.c @@ -1232,13 +1232,14 @@ static int CmdHF15ELoad(const char *Cmd) { return res; } - if (bytes_read != sizeof(iso15_tag_t)) { - PrintAndLogEx(FAILED, "Memory image is not matching tag structure."); + if (bytes_read == 0) { + PrintAndLogEx(FAILED, "Memory image empty."); free(tag); return PM3_EINVARG; } - if (bytes_read == 0) { - PrintAndLogEx(FAILED, "Memory image empty."); + + if (bytes_read != sizeof(iso15_tag_t)) { + PrintAndLogEx(FAILED, "Memory image is not matching tag structure."); free(tag); return PM3_EINVARG; } @@ -2693,13 +2694,14 @@ static int CmdHF15Restore(const char *Cmd) { return res; } - if (bytes_read != sizeof(iso15_tag_t)) { - PrintAndLogEx(FAILED, "Memory image is not matching tag structure."); + if (bytes_read == 0) { + PrintAndLogEx(FAILED, "Memory image empty."); free(tag); return PM3_EINVARG; } - if (bytes_read == 0) { - PrintAndLogEx(FAILED, "Memory image empty."); + + if (bytes_read != sizeof(iso15_tag_t)) { + PrintAndLogEx(FAILED, "Memory image is not matching tag structure."); free(tag); return PM3_EINVARG; } @@ -3357,13 +3359,14 @@ static int CmdHF15View(const char *Cmd) { return res; } - if (bytes_read != sizeof(iso15_tag_t)) { - PrintAndLogEx(FAILED, "Memory image is not matching tag structure."); + if (bytes_read == 0) { + PrintAndLogEx(FAILED, "Memory image empty."); free(tag); return PM3_EINVARG; } - if (bytes_read == 0) { - PrintAndLogEx(FAILED, "Memory image empty."); + + if (bytes_read != sizeof(iso15_tag_t)) { + PrintAndLogEx(FAILED, "Memory image is not matching tag structure."); free(tag); return PM3_EINVARG; } diff --git a/client/src/cmdhfntag424.c b/client/src/cmdhfntag424.c index 6275dab4d..9e4abeed2 100644 --- a/client/src/cmdhfntag424.c +++ b/client/src/cmdhfntag424.c @@ -38,6 +38,7 @@ // NTAG424 commands currently implemented +// icenam: should be able to use 14a / msdes to annotate NTAG424 communications #define NTAG424_CMD_GET_FILE_SETTINGS 0xF5 #define NTAG424_CMD_CHANGE_FILE_SETTINGS 0x5F #define NTAG424_CMD_CHANGE_KEY 0xC4