From fd656541dd68ccf4c6edf978f3ae3930f47b98d0 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Mon, 8 Mar 2021 00:28:38 +0100 Subject: [PATCH] fix lf t55xx wipe - calling write with correct params --- client/src/cmdlft55xx.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/client/src/cmdlft55xx.c b/client/src/cmdlft55xx.c index 7e86e1c78..11f397ca1 100644 --- a/client/src/cmdlft55xx.c +++ b/client/src/cmdlft55xx.c @@ -2939,35 +2939,36 @@ static int CmdT55xxWipe(const char *Cmd) { PrintAndLogEx(INFO, "Begin wiping..."); // Creating cmd string for write block :) - char writeData[36] = {0}; - char *ptrData = writeData; - snprintf(ptrData, sizeof(writeData), "-b 0 "); + char wcmd[36] = {0}; + char *pwcmd = wcmd; + + snprintf(pwcmd, sizeof(wcmd), "-b 0 "); if (usepwd) { - snprintf(ptrData + strlen(writeData), sizeof(writeData) - strlen(writeData), "p %08x ", password); + snprintf(pwcmd + strlen(wcmd), sizeof(wcmd) - strlen(wcmd), "-p %08x ", password); } - snprintf(ptrData + strlen(writeData), sizeof(writeData) - strlen(writeData), "d %08X", block0); + snprintf(pwcmd + strlen(wcmd), sizeof(wcmd) - strlen(wcmd), "-d %08X", block0); - if (CmdT55xxWriteBlock(ptrData) != PM3_SUCCESS) + if (CmdT55xxWriteBlock(pwcmd) != PM3_SUCCESS) PrintAndLogEx(WARNING, "Warning: error writing blk 0"); for (uint8_t blk = 1; blk < 8; blk++) { - snprintf(ptrData, sizeof(writeData), "-b %d -d 0", blk); + snprintf(pwcmd, sizeof(wcmd), "-b %d -d 00000000", blk); - if (CmdT55xxWriteBlock(ptrData) != PM3_SUCCESS) + if (CmdT55xxWriteBlock(pwcmd) != PM3_SUCCESS) PrintAndLogEx(WARNING, "Warning: error writing blk %d", blk); - memset(writeData, 0x00, sizeof(writeData)); + memset(wcmd, 0x00, sizeof(wcmd)); } // Check and rest t55xx downlink mode. if (config.downlink_mode != T55XX_DLMODE_FIXED) { // Detect found a different mode so card must support - snprintf(ptrData, sizeof(writeData), "-b 3 --pg1 -d 00000000"); - if (CmdT55xxWriteBlock(ptrData) != PM3_SUCCESS) { + snprintf(pwcmd, sizeof(wcmd), "-b 3 --pg1 -d 00000000"); + if (CmdT55xxWriteBlock(pwcmd) != PM3_SUCCESS) { PrintAndLogEx(WARNING, "Warning: failed writing block 3 page 1 (config)"); } - memset(writeData, 0x00, sizeof(writeData)); + memset(wcmd, 0x00, sizeof(wcmd)); } return PM3_SUCCESS; }