Skip to content

Commit d028bc7

Browse files
committed
Fix comparison when nfc_initiator_target_is_present() with a specified target
1 parent 22078a8 commit d028bc7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libnfc/chips/pn53x.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,7 @@ pn53x_initiator_select_passive_target_ext(struct nfc_device *pnd,
10591059
size_t szTargetsData = sizeof(abtTargetsData);
10601060
int res = 0;
10611061
nfc_target nttmp;
1062+
memset(&nttmp, 0x00, sizeof(nfc_target));
10621063

10631064
if (nm.nmt == NMT_ISO14443BI || nm.nmt == NMT_ISO14443B2SR || nm.nmt == NMT_ISO14443B2CT) {
10641065
if (CHIP_DATA(pnd)->type == RCS360) {
@@ -1148,7 +1149,6 @@ pn53x_initiator_select_passive_target_ext(struct nfc_device *pnd,
11481149
if (! found)
11491150
return 0;
11501151
} else {
1151-
11521152
const pn53x_modulation pm = pn53x_nm_to_pm(nm);
11531153
if ((PM_UNDEFINED == pm) || (NBR_UNDEFINED == nm.nbr)) {
11541154
pnd->last_error = NFC_EINVARG;
@@ -1221,6 +1221,8 @@ pn53x_initiator_poll_target(struct nfc_device *pnd,
12211221
szTargetTypes++;
12221222
}
12231223
nfc_target ntTargets[2];
1224+
memset(ntTargets, 0x00, sizeof(nfc_target) * 2);
1225+
12241226
if ((res = pn53x_InAutoPoll(pnd, apttTargetTypes, szTargetTypes, uiPollNr, uiPeriod, ntTargets, 0)) < 0)
12251227
return res;
12261228
switch (res) {

0 commit comments

Comments
 (0)