From 2e51318bcb78a424a2111fd4e823707a653b1995 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sun, 22 Sep 2013 03:31:50 +0200 Subject: [PATCH] pn53x_usb driver: verify return of pn53x_build_frame() Problem reported by Coverity: CID 1090322 (#1 of 1): Unchecked return value (CHECKED_RETURN) unchecked_value: No check of the return value of "pn53x_build_frame(abtFrame, &szFrame, pbtData, szData)". --- libnfc/drivers/pn53x_usb.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libnfc/drivers/pn53x_usb.c b/libnfc/drivers/pn53x_usb.c index dc2f4d6..e75a086 100644 --- a/libnfc/drivers/pn53x_usb.c +++ b/libnfc/drivers/pn53x_usb.c @@ -428,7 +428,10 @@ pn53x_usb_send(nfc_device *pnd, const uint8_t *pbtData, const size_t szData, con size_t szFrame = 0; int res = 0; - pn53x_build_frame(abtFrame, &szFrame, pbtData, szData); + if ((res = pn53x_build_frame(abtFrame, &szFrame, pbtData, szData)) < 0) { + pnd->last_error = res; + return pnd->last_error; + } if ((res = pn53x_usb_bulk_write(DRIVER_DATA(pnd), abtFrame, szFrame, timeout)) < 0) { pnd->last_error = res;