From 6fd29775b206556a8d87ebf90c7f742800681876 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Thu, 4 Oct 2012 15:28:30 +0000 Subject: [PATCH] acr122_usb: Fix compilation and length offset (bug introduced in r1461) --- libnfc/drivers/acr122_usb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libnfc/drivers/acr122_usb.c b/libnfc/drivers/acr122_usb.c index 7c27436..84079e2 100644 --- a/libnfc/drivers/acr122_usb.c +++ b/libnfc/drivers/acr122_usb.c @@ -715,11 +715,12 @@ read: // XXX In CCID specification, len is a 32-bits (dword), do we need to decode more than 1 byte ? (0-255 bytes for PN532 reply) len = abtRxBuf[offset++]; - if ((abtRxBuf[++] != 0x00) && (abtRxBuf[++] != 0x00) && (abtRxBuf[++] != 0x00)) { + if ((abtRxBuf[offset] != 0x00) && (abtRxBuf[offset+1] != 0x00) && (abtRxBuf[offset+2] != 0x00)) { log_put(LOG_CATEGORY, NFC_PRIORITY_ERROR, "%s", "Not implemented: only 1-byte length is supported, please report this bug with a full trace."); pnd->last_error = NFC_EIO; return pnd->last_error; } + offset += 3; if (len < 4) { log_put(LOG_CATEGORY, NFC_PRIORITY_ERROR, "%s", "Too small reply");