From fffe46e6520bdd81392f83895f6afeca321dcbf7 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sat, 24 Jul 2021 21:26:55 +0200 Subject: [PATCH] fix hf mf cload - now f param is optional --- client/src/cmdhfepa.c | 6 +++++- client/src/cmdhfmf.c | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/client/src/cmdhfepa.c b/client/src/cmdhfepa.c index 21b896032..6c7f48141 100644 --- a/client/src/cmdhfepa.c +++ b/client/src/cmdhfepa.c @@ -142,6 +142,7 @@ static int CmdHFEPAPACEReplay(const char *Cmd) { // fast push mode conn.block_after_ACK = true; for (int i = 0; i < ARRAYLEN(apdu_lengths); i++) { + // transfer the APDU in several parts if necessary for (int j = 0; j * sizeof(data) < apdu_lengths[i]; j++) { // amount of data in this packet @@ -161,7 +162,10 @@ static int CmdHFEPAPACEReplay(const char *Cmd) { // arg0: APDU number // arg1: offset into the APDU SendCommandOLD(CMD_HF_EPA_REPLAY, i + 1, j * sizeof(data), packet_length, data, packet_length); - WaitForResponse(CMD_ACK, &resp); + if (WaitForResponseTimeout(CMD_HF_EPA_REPLAY, &resp, 2500) == false) { + PrintAndLogEx(WARNING, "command time out"); + return PM3_ETIMEOUT; + } if (resp.oldarg[0] != 0) { PrintAndLogEx(WARNING, "Transfer of APDU #%d Part %d failed!", i, j); return PM3_ESOFT; diff --git a/client/src/cmdhfmf.c b/client/src/cmdhfmf.c index 985d156db..241b7f954 100644 --- a/client/src/cmdhfmf.c +++ b/client/src/cmdhfmf.c @@ -4372,17 +4372,18 @@ static int CmdHF14AMfCLoad(const char *Cmd) { ); void *argtable[] = { arg_param_begin, - arg_str1("f", "file", "", "filename of dump"), + arg_str0("f", "file", "", "filename of dump"), arg_lit0(NULL, "emu", "from emulator memory"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); int fnlen = 0; - char filename[FILE_PATH_SIZE]; + char filename[FILE_PATH_SIZE] = {0}; CLIParamStrToBuf(arg_get_str(ctx, 1), (uint8_t *)filename, FILE_PATH_SIZE, &fnlen); bool fill_from_emulator = arg_get_lit(ctx, 2); + CLIParserFree(ctx); if (fill_from_emulator) {