From 4c811fab0a3edd959509f96951738f14d4a3caf4 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Thu, 8 Aug 2024 20:11:31 +0200 Subject: [PATCH] fix hf mf wipe: detect properly write fails --- CHANGELOG.md | 1 + client/src/cmdhfmf.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 742ccb990..11ace03f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] +- Fixed `hf mf wipe` to detect properly write errors (@doegox) - Fixed `hf mf fchk` which was leaving the RF field on when interrupted by keyboard (@doegox) - Changed file saving: do not prepend with default path if given path is an absolute path (@doegox) - Added few tools to crack static encrypted nonce tags such as FM11RF08S (@doegox) diff --git a/client/src/cmdhfmf.c b/client/src/cmdhfmf.c index 4ba723e80..72c6f6636 100644 --- a/client/src/cmdhfmf.c +++ b/client/src/cmdhfmf.c @@ -7624,12 +7624,12 @@ static int CmdHF14AMfWipe(const char *Cmd) { SendCommandMIX(CMD_HF_MIFARE_WRITEBL, mfFirstBlockOfSector(s) + b, kt, 0, data, sizeof(data)); PacketResponseNG resp; if (WaitForResponseTimeout(CMD_ACK, &resp, 1500)) { - uint8_t isOK = resp.oldarg[0] & 0xff; - if (isOK == 0) { - PrintAndLogEx(NORMAL, "( " _RED_("fail") " )"); - } else { + int isOK = resp.oldarg[0]; + if (isOK > 0) { PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )"); break; + } else { + PrintAndLogEx(NORMAL, "( " _RED_("fail") " )"); } } else { PrintAndLogEx(WARNING, "Command execute timeout");