[Pcsclite-cvs-commit] r1983 - trunk/Drivers/ccid/src
Ludovic Rousseau
rousseau at costa.debian.org
Mon Mar 27 16:38:36 CEST 2006
Author: rousseau
Date: 2006-03-27 14:38:35 +0000 (Mon, 27 Mar 2006)
New Revision: 1983
Modified:
trunk/Drivers/ccid/src/commands.c
Log:
SecurePINModify(): separate the validation test in three different tests
and add a debug message for each test
Modified: trunk/Drivers/ccid/src/commands.c
===================================================================
--- trunk/Drivers/ccid/src/commands.c 2006-03-27 14:23:30 UTC (rev 1982)
+++ trunk/Drivers/ccid/src/commands.c 2006-03-27 14:38:35 UTC (rev 1983)
@@ -336,17 +336,31 @@
/* 24 is the size of the PCSC PIN modify structure
* The equivalent CCID structure is only 18 or 19-bytes long */
- if ((TxLength > 19+CMD_BUF_SIZE) /* command too large? */
- || (TxLength < 18+4 /* 4 = APDU size */) /* command too short? */
- || (TxBuffer[20] + 24 != TxLength)) /* ulDataLength field coherency */
+ if (TxLength > 24+CMD_BUF_SIZE) /* command too large? */
{
+ DEBUG_INFO3("Command too long: %d > %d", TxLength, 24+CMD_BUF_SIZE);
*RxLength = 0;
return IFD_NOT_SUPPORTED;
}
+ if (TxLength < 24+4 /* 4 = APDU size */) /* command too short? */
+ {
+ DEBUG_INFO3("Command too short: %d < %d", TxLength, 24+4);
+ *RxLength = 0;
+ return IFD_NOT_SUPPORTED;
+ }
+
+ if (dw2i(TxBuffer, 20) + 24 != TxLength) /* ulDataLength field coherency */
+ {
+ DEBUG_INFO3("Wrong lengths: %d %d", dw2i(TxBuffer, 20) + 24, TxLength);
+ *RxLength = 0;
+ return IFD_NOT_SUPPORTED;
+ }
+
/* Make sure in the beginning if bNumberMessage is valid or not */
if (TxBuffer[11] > 3)
{
+ DEBUG_INFO2("Wrong bNumberMessage: %d", TxBuffer[11]);
*RxLength = 0;
return IFD_NOT_SUPPORTED;
}
More information about the Pcsclite-cvs-commit
mailing list