From ff87cf62b15037fb469b9e1f564692ef02f0aad6 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Fri, 18 May 2012 21:54:55 +0000 Subject: [PATCH] Fix segfault in pn53x_initiator_transceive_bytes when pszRx in NULL Cause was "return *pszRx" Segfault occured when listing a typeB' --- libnfc/chips/pn53x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index 9a78249..dbf800e 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -1332,7 +1332,7 @@ pn53x_initiator_transceive_bytes (struct nfc_device *pnd, const uint8_t *pbtTx, memcpy (pbtRx, abtRx + 1, *pszRx); } // Everything went successful, we return received bytes count - return *pszRx; + return (szRx - 1); } static void __pn53x_init_timer(struct nfc_device *pnd, const uint32_t max_cycles)