Skip to content

Commit 579ea6f

Browse files
committed
Patch mf_write_sector 4k support
1 parent 11becb8 commit 579ea6f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

client/src/mifare/mifarehost.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,8 +1016,8 @@ int mf_write_block(uint8_t blockno, uint8_t keyType, const uint8_t *key, uint8_t
10161016

10171017
int mf_write_sector(uint8_t sectorNo, uint8_t keyType, const uint8_t *key, uint8_t *sector) {
10181018
int res;
1019-
for (int i = 0; i < 4; i++) {
1020-
res = mf_write_block((sectorNo * 4) + i, keyType, key, sector + (i * MFBLOCK_SIZE));
1019+
for (int i = 0; i < mfNumBlocksPerSector(sectorNo); i++) {
1020+
res = mf_write_block((mfFirstBlockOfSector(sectorNo)) + i, keyType, key, sector + (i * MFBLOCK_SIZE));
10211021
if (res != PM3_SUCCESS) {
10221022
return (i == 0) ? PM3_EFAILED : PM3_EPARTIAL;
10231023
}

0 commit comments

Comments
 (0)