From d028bc725d058e9db9d25340ea3f586526b718b9 Mon Sep 17 00:00:00 2001 From: Romuald Conty Date: Mon, 18 May 2015 20:14:18 +0200 Subject: [PATCH] Fix comparison when nfc_initiator_target_is_present() with a specified target --- libnfc/chips/pn53x.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libnfc/chips/pn53x.c b/libnfc/chips/pn53x.c index 4114231..a5b69c8 100644 --- a/libnfc/chips/pn53x.c +++ b/libnfc/chips/pn53x.c @@ -1059,6 +1059,7 @@ pn53x_initiator_select_passive_target_ext(struct nfc_device *pnd, size_t szTargetsData = sizeof(abtTargetsData); int res = 0; nfc_target nttmp; + memset(&nttmp, 0x00, sizeof(nfc_target)); if (nm.nmt == NMT_ISO14443BI || nm.nmt == NMT_ISO14443B2SR || nm.nmt == NMT_ISO14443B2CT) { if (CHIP_DATA(pnd)->type == RCS360) { @@ -1148,7 +1149,6 @@ pn53x_initiator_select_passive_target_ext(struct nfc_device *pnd, if (! found) return 0; } else { - const pn53x_modulation pm = pn53x_nm_to_pm(nm); if ((PM_UNDEFINED == pm) || (NBR_UNDEFINED == nm.nbr)) { pnd->last_error = NFC_EINVARG; @@ -1221,6 +1221,8 @@ pn53x_initiator_poll_target(struct nfc_device *pnd, szTargetTypes++; } nfc_target ntTargets[2]; + memset(ntTargets, 0x00, sizeof(nfc_target) * 2); + if ((res = pn53x_InAutoPoll(pnd, apttTargetTypes, szTargetTypes, uiPollNr, uiPeriod, ntTargets, 0)) < 0) return res; switch (res) {