From 93011b4c074f140c4e204a838ce0a39389a7c34f Mon Sep 17 00:00:00 2001
From: Romain Tartiere <romain.tartiere@gmail.com>
Date: Fri, 1 Oct 2010 19:32:03 +0000
Subject: [PATCH] Use the actual UID length to select a target.

Without it, the libfreefare cannot use 4-bytes-long random UIDs of Mifare
DESFire EV1.
---
 libfreefare/mifare_desfire.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libfreefare/mifare_desfire.c b/libfreefare/mifare_desfire.c
index 28a7eed..1c7ed95 100644
--- a/libfreefare/mifare_desfire.c
+++ b/libfreefare/mifare_desfire.c
@@ -282,7 +282,7 @@ mifare_desfire_connect (MifareTag tag)
     ASSERT_MIFARE_DESFIRE (tag);
 
     nfc_target_info_t pnti;
-    if (nfc_initiator_select_passive_target (tag->device, NM_ISO14443A_106, tag->info.abtUid, 7, &pnti)) {
+    if (nfc_initiator_select_passive_target (tag->device, NM_ISO14443A_106, tag->info.abtUid, tag->info.szUidLen, &pnti)) {
 	tag->active = 1;
 	free (MIFARE_DESFIRE (tag)->session_key);
 	MIFARE_DESFIRE (tag)->session_key = NULL;