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) {