From e5a71fdd2648ff2ebe6a84dce18d549fc6227bb0 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Thu, 14 Mar 2019 10:01:07 +0100 Subject: [PATCH] fix: 'hf iclass clone' - missing fclose --- client/cmdhficlass.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/cmdhficlass.c b/client/cmdhficlass.c index 5f77e7c85..11677a32c 100644 --- a/client/cmdhficlass.c +++ b/client/cmdhficlass.c @@ -1375,11 +1375,14 @@ int CmdHFiClassCloneTag(const char *Cmd) { return 2; } + fclose(f); + uint8_t MAC[4] = {0x00, 0x00, 0x00, 0x00}; uint8_t div_key[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - if (!select_and_auth(KEY, MAC, div_key, use_credit_key, elite, rawkey, verbose)) + if (!select_and_auth(KEY, MAC, div_key, use_credit_key, elite, rawkey, verbose)) { return 0; + } UsbCommand w = {CMD_ICLASS_CLONE, {startblock, endblock}}; uint8_t *ptr; @@ -1401,11 +1404,12 @@ int CmdHFiClassCloneTag(const char *Cmd) { PrintAndLogEx(NORMAL, " %02x%02x%02x%02x%02x%02x%02x%02x |", p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); PrintAndLogEx(NORMAL, " MAC |%02x%02x%02x%02x|\n", p[8], p[9], p[10], p[11]); } + UsbCommand resp; clearCommandBuffer(); SendCommand(&w); if (!WaitForResponseTimeout(CMD_ACK, &resp, 4500)) { - PrintAndLogEx(WARNING, "command execute timeout"); + PrintAndLogEx(WARNING, "command execute timeout"); return 0; } return 1;