From 2380583ec660b0dc3be17a008a90e3fa429364a8 Mon Sep 17 00:00:00 2001 From: Romain Tartiere Date: Thu, 18 Feb 2010 18:09:34 +0000 Subject: [PATCH] fix the mifare_classic_transfer() function. --- libfreefare/mifare_classic.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libfreefare/mifare_classic.c b/libfreefare/mifare_classic.c index d705a71..8bbdc6d 100644 --- a/libfreefare/mifare_classic.c +++ b/libfreefare/mifare_classic.c @@ -470,7 +470,12 @@ mifare_classic_restore (MifareClassicTag tag, const MifareClassicBlockNumber blo { ASSERT_ACTIVE (tag); - unsigned char command[2]; + /* + * Same length as the increment and decrement commands but only the first + * two bytes are actually used. The 4 bytes after the block number are + * meaningless but required (thus left uninitialized). + */ + unsigned char command[6]; /* XXX Should be MC_RESTORE according to the MIFARE documentation. */ command[0] = MC_STORE; command[1] = block;