From 6354e9465799767d6d81995ccdfc0c3e7d428cd0 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Wed, 18 Aug 2010 13:53:34 +0000 Subject: [PATCH] mifare function improvement: it now failed when read command does not return a whole block (16 bytes). --- examples/mifare.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/mifare.c b/examples/mifare.c index cd8d811..45387d0 100644 --- a/examples/mifare.c +++ b/examples/mifare.c @@ -69,7 +69,13 @@ bool nfc_initiator_mifare_cmd(const nfc_device_t* pnd, const mifare_cmd mc, cons if (!nfc_initiator_transceive_dep_bytes(pnd,abtCmd,2+szParamLen,abtRx,&szRxLen)) return false; // When we have executed a read command, copy the received bytes into the param - if (mc == MC_READ && szRxLen == 16) memcpy(pmp->mpd.abtData,abtRx,16); + if (mc == MC_READ) { + if(szRxLen == 16) { + memcpy(pmp->mpd.abtData,abtRx,16); + } else { + return false; + } + } // Command succesfully executed return true;