From 61884967ea0a00f83365e66d8c400dc73357c01c Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sun, 22 Sep 2013 02:45:23 +0200 Subject: [PATCH] nfc-mfclassic: verify return of nfc_initiator_select_passive_target() Problem reported by Coverity: CID 1090323 (#1 of 1): Unchecked return value (CHECKED_RETURN) unchecked_value: No check of the return value of "nfc_initiator_select_passive_target(pnd, nmMifare, nt.nti.nai.abtUid, nt.nti.nai.szUidLen, NULL)". --- utils/nfc-mfclassic.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/nfc-mfclassic.c b/utils/nfc-mfclassic.c index c1f834c..8eefa85 100644 --- a/utils/nfc-mfclassic.c +++ b/utils/nfc-mfclassic.c @@ -215,7 +215,10 @@ authenticate(uint32_t uiBlock) memcpy(mtKeys.amb[uiBlock].mbt.abtKeyB, &mp.mpa.abtKey, 6); return true; } - nfc_initiator_select_passive_target(pnd, nmMifare, nt.nti.nai.abtUid, nt.nti.nai.szUidLen, NULL); + if (nfc_initiator_select_passive_target(pnd, nmMifare, nt.nti.nai.abtUid, nt.nti.nai.szUidLen, NULL) <= 0) { + ERR("tag was removed"); + return false; + } } }