fix: hf mfu ndef - ul ev1 48 bytes with a NDEF otp. e1101200, max size mismatch. Now it will select smallest

This commit is contained in:
iceman1001 2020-04-05 16:59:14 +02:00
commit 214bb46e9c

View file

@ -2781,7 +2781,20 @@ static int CmdHF14MfuNDEF(const char *Cmd) {
// max datasize; // max datasize;
maxsize = ndef_get_maxsize(data + 12); 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 // allocate mem
uint8_t *records = calloc(maxsize, sizeof(uint8_t)); uint8_t *records = calloc(maxsize, sizeof(uint8_t));
if (records == NULL) { if (records == NULL) {