NFC: Fix 0 block write possibility in Mifare Classic emulation (#2474)

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
AloneLiberty 2023-03-09 20:50:25 +03:00 committed by GitHub
parent 5b05aeea82
commit 0190a161ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -291,6 +291,10 @@ bool mf_classic_is_allowed_access_data_block(
uint8_t* sector_trailer = uint8_t* sector_trailer =
data->block[mf_classic_get_sector_trailer_num_by_block(block_num)].value; data->block[mf_classic_get_sector_trailer_num_by_block(block_num)].value;
if(block_num == 0 && action == MfClassicActionDataWrite) {
return false;
}
uint8_t sector_block; uint8_t sector_block;
if(block_num <= 128) { if(block_num <= 128) {
sector_block = block_num & 0x03; sector_block = block_num & 0x03;