From 84c3e8a3baa2b767364803f4238e43aa050feaf0 Mon Sep 17 00:00:00 2001 From: Adam Laurie Date: Mon, 30 Jan 2017 21:47:06 +0000 Subject: [PATCH] Fix number of blocks written. Fix number of written blocks reported. --- utils/nfc-mfultralight.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/nfc-mfultralight.c b/utils/nfc-mfultralight.c index 4b9f39d..eeea304 100644 --- a/utils/nfc-mfultralight.c +++ b/utils/nfc-mfultralight.c @@ -276,7 +276,7 @@ write_card(bool write_otp, bool write_lock, bool write_uid) } } - for (uint32_t page = uiSkippedPages; page <= ((uiBlocks / 4) * 4); page++) { + for (uint32_t page = uiSkippedPages; page <= (((uiBlocks + 1) / 4) * 4); page++) { if ((page == 0x2) && (!write_lock)) { printf("s"); uiSkippedPages++; @@ -309,7 +309,7 @@ write_card(bool write_otp, bool write_lock, bool write_uid) print_success_or_failure(bFailure, &uiWritenPages); } printf("|\n"); - printf("Done, %d of %d pages written (%d pages skipped).\n", uiWritenPages, uiBlocks + 1, uiSkippedPages); + printf("Done, %d of %d pages written (%d pages skipped).\n", uiWritenPages - 1, uiBlocks + 1, uiSkippedPages); return true; }