From 4828211e97e00b8b4aca51892785feed9090084a Mon Sep 17 00:00:00 2001 From: Romain Tartiere Date: Wed, 18 May 2011 22:25:09 +0000 Subject: [PATCH] Fix crash when usb_bulk_read() fails. --- libnfc/drivers/pn53x_usb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libnfc/drivers/pn53x_usb.c b/libnfc/drivers/pn53x_usb.c index 41c3019..2a102da 100644 --- a/libnfc/drivers/pn53x_usb.c +++ b/libnfc/drivers/pn53x_usb.c @@ -77,7 +77,8 @@ int pn53x_usb_bulk_read (struct pn53x_usb_data *data, byte_t abtRx[], const size_t szRx) { int res = usb_bulk_read (data->pudh, data->uiEndPointIn, (char *) abtRx, szRx, USB_TIMEOUT); - PRINT_HEX ("RX", abtRx, res); + if (res > 0) + PRINT_HEX ("RX", abtRx, res); return res; } int