[Pcsclite-cvs-commit] r6962 - trunk/Drivers/ccid/src

ludovic.rousseau at free.fr ludovic.rousseau at free.fr
Tue Aug 26 09:14:11 UTC 2014


Author: rousseau
Date: 2014-08-26 09:14:10 +0000 (Tue, 26 Aug 2014)
New Revision: 6962

Modified:
   trunk/Drivers/ccid/src/ifdhandler.c
Log:
Check value returned by ATR_InitFromArray()

The ATR may be invalid and ATR_InitFromArray() may return ATR_MALFORMED.
I have not yet seen this problem in the field but it is better to ba
safe.


Modified: trunk/Drivers/ccid/src/ifdhandler.c
===================================================================
--- trunk/Drivers/ccid/src/ifdhandler.c	2014-08-25 19:19:03 UTC (rev 6961)
+++ trunk/Drivers/ccid/src/ifdhandler.c	2014-08-26 09:14:10 UTC (rev 6962)
@@ -666,6 +666,7 @@
 	unsigned int len;
 	int convention;
 	int reader_index;
+	int atr_ret;
 
 	/* Set ccid desc params */
 	CcidDesc *ccid_slot;
@@ -694,8 +695,10 @@
 	}
 
 	/* Get ATR of the card */
-	(void)ATR_InitFromArray(&atr, ccid_slot->pcATRBuffer,
+	atr_ret = ATR_InitFromArray(&atr, ccid_slot->pcATRBuffer,
 		ccid_slot->nATRLength);
+	if (ATR_MALFORMED == atr_ret)
+		return IFD_PROTOCOL_NOT_SUPPORTED;
 
 	/* Apply Extra EGT patch for bogus cards */
 	extra_egt(&atr, ccid_desc, Protocol);




More information about the Pcsclite-cvs-commit mailing list