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;