Fix buffer over-read in MADCardHolderInfoDecode

This commit is contained in:
achazal committed 2026-06-02 19:04:11 +02:00
1 parent c46b72ee2b
commit 10cd87175d
1 file changed
+6 -4
+6 -4
View File
@@ -289,12 +289,14 @@ int MADCardHolderInfoDecode(uint8_t *data, size_t datalen, bool verbose) {
uint8_t len = data[idx] & 0x3f;
uint8_t type = data[idx] >> 6;
idx++;
if (len > 0) {
PrintAndLogEx(INFO, "%14s " _GREEN_("%.*s"), holder_info_type[type], len, &data[idx]);
idx += len;
} else {
if (len == 0)
break;
if (idx + len > datalen) {
PrintAndLogEx(WARNING, "Card holder info truncated (need %u bytes, %zu available)", len, datalen - idx);
break;
}
PrintAndLogEx(INFO, "%14s " _GREEN_("%.*s"), holder_info_type[type], len, &data[idx]);
idx += len;
}
return PM3_SUCCESS;
}