[Pcsclite-cvs-commit] r6809 - trunk/Drivers/ccid/examples

ludovic.rousseau at free.fr ludovic.rousseau at free.fr
Tue Dec 17 08:57:30 UTC 2013


Author: rousseau
Date: 2013-12-17 08:57:30 +0000 (Tue, 17 Dec 2013)
New Revision: 6809

Modified:
   trunk/Drivers/ccid/examples/scardcontrol.c
Log:
Fix calculation of the command length

Since pcsc-lite 1.8.9 (October 2013) the structures PIN_MODIFY_STRUCTURE
and PIN_VERIFY_STRUCTURE are different and now use a C99 flexible array
member when available for abData field. uint8_t abData[];

The the sizeof(PIN_VERIFY_STRUCTURE) is one byte smaller and the
calculation of the complete command is now simpler.


Modified: trunk/Drivers/ccid/examples/scardcontrol.c
===================================================================
--- trunk/Drivers/ccid/examples/scardcontrol.c	2013-12-14 17:50:43 UTC (rev 6808)
+++ trunk/Drivers/ccid/examples/scardcontrol.c	2013-12-17 08:57:30 UTC (rev 6809)
@@ -568,7 +568,7 @@
 	pin_verify -> abData[offset++] = 0x00;	/* '\0' */
 	pin_verify -> ulDataLength = offset;	/* APDU size */
 
-	length = sizeof(PIN_VERIFY_STRUCTURE) + offset -1;	/* -1 because PIN_VERIFY_STRUCTURE contains the first byte of abData[] */
+	length = sizeof(PIN_VERIFY_STRUCTURE) + offset;
 
 	printf(" command:");
 	for (i=0; i<length; i++)
@@ -712,7 +712,7 @@
 	pin_modify -> abData[offset++] = 0x30;	/* '0' */
 	pin_modify -> ulDataLength = offset;	/* APDU size */
 
-	length = sizeof(PIN_MODIFY_STRUCTURE) + offset -1;	/* -1 because PIN_MODIFY_STRUCTURE contains the first byte of abData[] */
+	length = sizeof(PIN_MODIFY_STRUCTURE) + offset;
 
 	printf(" command:");
 	for (i=0; i<length; i++)




More information about the Pcsclite-cvs-commit mailing list