[Pcsclite-cvs-commit] r6684 - trunk/Drivers/ccid/src/towitoko

ludovic.rousseau at free.fr ludovic.rousseau at free.fr
Sun Jul 28 09:30:22 UTC 2013


Author: rousseau
Date: 2013-07-05 07:11:41 +0000 (Fri, 05 Jul 2013)
New Revision: 6684

Modified:
   trunk/Drivers/ccid/src/towitoko/atr.c
Log:
ATR_InitFromArray(): avoid a possible buffer overflow

Increment the protocol index _before_ checking it is too big.


Modified: trunk/Drivers/ccid/src/towitoko/atr.c
===================================================================
--- trunk/Drivers/ccid/src/towitoko/atr.c	2013-07-04 07:25:16 UTC (rev 6683)
+++ trunk/Drivers/ccid/src/towitoko/atr.c	2013-07-05 07:11:41 UTC (rev 6684)
@@ -127,9 +127,9 @@
 	  TDi = atr->ib[pn][ATR_INTERFACE_BYTE_TD].value = atr_buffer[pointer];
 	  atr->ib[pn][ATR_INTERFACE_BYTE_TD].present = TRUE;
 	  (atr->TCK).present = ((TDi & 0x0F) != ATR_PROTOCOL_TYPE_T0);
+	  pn++;
 	  if (pn >= ATR_MAX_PROTOCOLS)
 	    return (ATR_MALFORMED);
-	  pn++;
 	}
       else
 	{




More information about the Pcsclite-cvs-commit mailing list