[Pcsclite-cvs-commit] r2088 - trunk/Drivers/ccid/src
Ludovic Rousseau
rousseau at costa.debian.org
Mon Jul 3 13:44:29 UTC 2006
Author: rousseau
Date: 2006-07-03 13:44:28 +0000 (Mon, 03 Jul 2006)
New Revision: 2088
Modified:
trunk/Drivers/ccid/src/commands.c
Log:
move the "command length too big" checks from CmdXfrBlock() to
CmdXfrBlockTPDU_T0()
Modified: trunk/Drivers/ccid/src/commands.c
===================================================================
--- trunk/Drivers/ccid/src/commands.c 2006-07-03 13:36:49 UTC (rev 2087)
+++ trunk/Drivers/ccid/src/commands.c 2006-07-03 13:44:28 UTC (rev 2088)
@@ -713,24 +713,6 @@
RESPONSECODE return_value = IFD_SUCCESS;
_ccid_descriptor *ccid_descriptor = get_ccid_descriptor(reader_index);
- /* command length too big for CCID reader? */
- if (tx_length > ccid_descriptor->dwMaxCCIDMessageLength)
- {
- DEBUG_CRITICAL3("Command too long (%d bytes) for max: %d bytes",
- tx_length, ccid_descriptor->dwMaxCCIDMessageLength);
- return_value = IFD_COMMUNICATION_ERROR;
- goto clean_up_and_return;
- }
-
- /* command length too big for CCID driver? */
- if (tx_length > CMD_BUF_SIZE)
- {
- DEBUG_CRITICAL3("Command too long (%d bytes) for max: %d bytes",
- tx_length, CMD_BUF_SIZE);
- return_value = IFD_COMMUNICATION_ERROR;
- goto clean_up_and_return;
- }
-
/* APDU or TPDU? */
switch (ccid_descriptor->dwFeatures & CCID_CLASS_EXCHANGE_MASK)
{
@@ -891,9 +873,26 @@
unsigned char rx_buffer[])
{
RESPONSECODE return_value = IFD_SUCCESS;
+ _ccid_descriptor *ccid_descriptor = get_ccid_descriptor(reader_index);
DEBUG_COMM2("T=0: %d bytes", tx_length);
+ /* command length too big for CCID reader? */
+ if (tx_length > ccid_descriptor->dwMaxCCIDMessageLength-10)
+ {
+ DEBUG_CRITICAL3("Command too long (%d bytes) for max: %d bytes",
+ tx_length, ccid_descriptor->dwMaxCCIDMessageLength-10);
+ return IFD_COMMUNICATION_ERROR;
+ }
+
+ /* command length too big for CCID driver? */
+ if (tx_length > CMD_BUF_SIZE)
+ {
+ DEBUG_CRITICAL3("Command too long (%d bytes) for max: %d bytes",
+ tx_length, CMD_BUF_SIZE);
+ return IFD_COMMUNICATION_ERROR;
+ }
+
return_value = CCID_Transmit(reader_index, tx_length, tx_buffer, 0, 0);
if (return_value != IFD_SUCCESS)
return return_value;
More information about the Pcsclite-cvs-commit
mailing list