From ed62b01a0f0ecc279c8146065462d1b03095e029 Mon Sep 17 00:00:00 2001 From: Olliver Schinagl Date: Wed, 11 May 2016 14:24:59 +0200 Subject: [PATCH] nfc-mfultralight: write uiBlocks, as we read We use a variable, uiBlocks, to determine how many blocks to read/write. Reading is actually done via a hardcoded 0xF value however. Additionally, make uiblocks a const, as we use it as a constant and change the page variable to uint32_t for consistency sake. Signed-off-by: Olliver Schinagl --- utils/nfc-mfultralight.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/nfc-mfultralight.c b/utils/nfc-mfultralight.c index ea0f7dc..82707a9 100644 --- a/utils/nfc-mfultralight.c +++ b/utils/nfc-mfultralight.c @@ -60,12 +60,13 @@ #define MAX_TARGET_COUNT 16 #define MAX_UID_LEN 10 +#define BLOCK_COUNT 0xf static nfc_device *pnd; static nfc_target nt; static mifare_param mp; static mifareul_tag mtDump; -static uint32_t uiBlocks = 0xF; +static const uint32_t uiBlocks = BLOCK_COUNT; // special unlock command uint8_t abtUnlock1[1] = { 0x40 }; @@ -275,7 +276,7 @@ write_card(bool write_otp, bool write_lock, bool write_uid) } } - for (int page = uiSkippedPages; page <= 0xF; page++) { + for (uint32_t page = uiSkippedPages; page <= ((uiBlocks / 4) * 4); page++) { if ((page == 0x2) && (!write_lock)) { printf("s"); uiSkippedPages++;