[Pcsclite-cvs-commit] r4796 - /trunk/Drivers/ccid/src/commands.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Fri Mar 5 10:12:51 UTC 2010


Author: rousseau
Date: Fri Mar  5 10:12:51 2010
New Revision: 4796

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=4796
Log:
CmdXfrBlockCHAR_T0(): limit the received length to 0x1000 for ICCD
Version A
length is 16-bits and usb_control_msg() fails with "Invalid argument" if
the length is > 0x100

The same patch was already present in CmdXfrBlockAPDU_extended for ICCD
Version B

Thanks to Alexander Abarzhi for the patch

Modified:
    trunk/Drivers/ccid/src/commands.c

Modified: trunk/Drivers/ccid/src/commands.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/commands.c?rev=4796&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/commands.c (original)
+++ trunk/Drivers/ccid/src/commands.c Fri Mar  5 10:12:51 2010
@@ -1811,6 +1811,12 @@
 	{
 		unsigned char pcbuffer[SIZE_GET_SLOT_STATUS];
 
+		/* length is on 16-bits only
+		 * if a size > 0x1000 is used then usb_control_msg() fails with
+		 * "Invalid argument" */
+		if (*rcv_len > 0x1000)
+			*rcv_len = 0x1000;
+
 		/* Command to send to the smart card (must be 5 bytes) */
 		memset(cmd, 0, sizeof(cmd));
 		if (snd_len == 4)




More information about the Pcsclite-cvs-commit mailing list