From 5280ada0549b593f095904bc82b077ea15cb2be2 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Mon, 24 Oct 2022 18:49:40 +0200 Subject: [PATCH] bug fix, added 0xFE in the wrong place --- client/src/cmdhfmf.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/src/cmdhfmf.c b/client/src/cmdhfmf.c index 6089b6514..4fdeedbe0 100644 --- a/client/src/cmdhfmf.c +++ b/client/src/cmdhfmf.c @@ -6054,7 +6054,7 @@ int CmdHFMFNDEFWrite(const char *Cmd) { } // Has raw bytes ndef a terminator block? - if (raw[bytes] != 0xFE) { + if (raw[bytes - 1] != 0xFE) { if (fix_msg == false) { PrintAndLogEx(WARNING, "raw NDEF message doesn't have a terminator block, continuing..."); } else { @@ -6063,13 +6063,15 @@ int CmdHFMFNDEFWrite(const char *Cmd) { PrintAndLogEx(WARNING, "no room for terminator block, exiting..."); return PM3_EMALLOC; } - raw[bytes++] = 0xFE; + raw[bytes] = 0xFE; + bytes++; PrintAndLogEx(SUCCESS, "Added terminator block (0xFE)"); } } if (verbose) { - PrintAndLogEx(INFO, "raw: %s", sprint_hex(raw, bytes)); + PrintAndLogEx(INFO, "Num of Bytes... %u", bytes); + print_buffer(raw, bytes, 0); } // read MAD Sector 0, block1,2