From d050e473b7cc577c9a77750cbc900a32f274e81d Mon Sep 17 00:00:00 2001 From: Brian Pow Date: Mon, 5 Feb 2018 18:59:24 +0800 Subject: [PATCH] CHG: use FillFileNameByUID() for filename generation for 'hf mf dump' and 'hf mf chk * ? d' --- client/cmdhfmf.c | 18 ++++++++---------- client/util.c | 16 +++++++++------- client/util.h | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/client/cmdhfmf.c b/client/cmdhfmf.c index 997cf1275..0851cbf7d 100644 --- a/client/cmdhfmf.c +++ b/client/cmdhfmf.c @@ -340,7 +340,7 @@ int usage_hf14_nack(void) { return 0; } -int GetHFMF14AUID(uint8_t *uid) { +int GetHFMF14AUID(uint8_t *uid, int *uidlen) { UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0}}; clearCommandBuffer(); SendCommand(&c); @@ -355,25 +355,23 @@ int GetHFMF14AUID(uint8_t *uid) { iso14a_card_select_t card; memcpy(&card, (iso14a_card_select_t *)resp.d.asBytes, sizeof(iso14a_card_select_t)); memcpy(uid, card.uid, card.uidlen * sizeof(uint8_t)); + *uidlen=card.uidlen; return 1; } char * GenerateFilename(const char *prefix, const char *suffix){ - uint8_t uid[4] = {0,0,0,0}; - int len=0; + uint8_t uid[8] = {0,0,0,0,0,0,0,0}; + int uidlen=0; char * fptr = malloc (sizeof (char) * (strlen(prefix) + strlen(suffix)) + sizeof(uid)*2 + 1); - if (!GetHFMF14AUID(uid)) { + if (!GetHFMF14AUID(uid, &uidlen)) { PrintAndLog("No tag found."); return NULL; } - strcpy(fptr, prefix); - len=strlen(fptr); - for (int i=0;i