[Pcsclite-cvs-commit] r2110 - trunk/Drivers/ccid/src
Ludovic Rousseau
rousseau at costa.debian.org
Wed Jul 12 09:52:31 UTC 2006
Author: rousseau
Date: 2006-07-12 09:52:30 +0000 (Wed, 12 Jul 2006)
New Revision: 2110
Modified:
trunk/Drivers/ccid/src/commands.c
Log:
CCID_Receive(): check that we received at least enough bytes to test
cmd[STATUS_OFFSET].
usb_bulk_read() will return 0 bytes without error in case of timeout
Modified: trunk/Drivers/ccid/src/commands.c
===================================================================
--- trunk/Drivers/ccid/src/commands.c 2006-07-12 08:30:26 UTC (rev 2109)
+++ trunk/Drivers/ccid/src/commands.c 2006-07-12 09:52:30 UTC (rev 2110)
@@ -821,6 +821,13 @@
return IFD_COMMUNICATION_ERROR;
}
+ if (length < STATUS_OFFSET)
+ {
+ DEBUG_CRITICAL2("Not enough data received: %d bytes", length);
+ *rx_length = 0;
+ return IFD_COMMUNICATION_ERROR;
+ }
+
if (cmd[STATUS_OFFSET] & CCID_COMMAND_FAILED)
{
ccid_error(cmd[ERROR_OFFSET], __FILE__, __LINE__, __FUNCTION__); /* bError */
More information about the Pcsclite-cvs-commit
mailing list