From 5cda3af5d4cbb3d972be2b901b3605bc7605c249 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Tue, 2 Jul 2013 23:40:25 +0200 Subject: [PATCH] Fix warnings Null pointer passed as an argument to a nonnull parameter acr122s.c:331:3: warning: Null pointer passed as an argument to a 'nonnull' parameter memcpy(buf, data, data_size); ^ ~~~~ pn53x.c:3138:3: warning: Null pointer passed as an argument to a 'nonnull' parameter memcpy(CHIP_DATA(pnd)->current_target, pnt, sizeof(nfc_target)); ^ ~~~ --- libnfc/chips/pn53x.c | 3 +++ libnfc/drivers/acr122s.c | 2 ++ 2 files changed, 5 insertions(+) diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index b407401..09e4dae 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -3127,6 +3127,9 @@ pn53x_get_information_about(nfc_device *pnd, char **pbuf) void * pn53x_current_target_new(const struct nfc_device *pnd, const nfc_target *pnt) { + if (pnt == NULL) { + return NULL; + } // Keep the current nfc_target for further commands if (CHIP_DATA(pnd)->current_target) { free(CHIP_DATA(pnd)->current_target); diff --git a/libnfc/drivers/acr122s.c b/libnfc/drivers/acr122s.c index 55a57c3..db2ea68 100644 --- a/libnfc/drivers/acr122s.c +++ b/libnfc/drivers/acr122s.c @@ -308,6 +308,8 @@ acr122s_build_frame(nfc_device *pnd, return false; if (data_size + should_prefix > 255) return false; + if (data == NULL) + return false; struct xfr_block_req *req = (struct xfr_block_req *) &frame[1]; req->message_type = XFR_BLOCK_REQ_MSG;