From 214bb46e9c073c7e7479c34372c516fca121d58a Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sun, 5 Apr 2020 16:59:14 +0200 Subject: [PATCH] fix: hf mfu ndef - ul ev1 48 bytes with a NDEF otp. e1101200, max size mismatch. Now it will select smallest --- client/cmdhfmfu.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/client/cmdhfmfu.c b/client/cmdhfmfu.c index 1f97c6b36..7c204f861 100644 --- a/client/cmdhfmfu.c +++ b/client/cmdhfmfu.c @@ -2781,7 +2781,20 @@ static int CmdHF14MfuNDEF(const char *Cmd) { // max datasize; maxsize = ndef_get_maxsize(data + 12); } - + + // iceman: maybe always take MIN of tag identified size vs NDEF reported size? + // fix: UL_EV1 48bytes != NDEF reported size + for (uint8_t i = 0; i < ARRAYLEN(UL_TYPES_ARRAY); i++) { + if (tagtype & UL_TYPES_ARRAY[i]) { + + if (maxsize != (UL_MEMORY_ARRAY[i] * 4) ) { + PrintAndLogEx(INFO, "Tag reported size vs NDEF reported size mismatch. Using smallest value"); + } + maxsize = MIN(maxsize, (UL_MEMORY_ARRAY[i] * 4)); + break; + } + } + // allocate mem uint8_t *records = calloc(maxsize, sizeof(uint8_t)); if (records == NULL) {