File data-structure.patch of Package pcsc-cyberjack
diff --git a/cjeca32/CCIDReader.cpp b/cjeca32/CCIDReader.cpp
index 1ab4135..91489bc 100644
--- a/cjeca32/CCIDReader.cpp
+++ b/cjeca32/CCIDReader.cpp
@@ -3115,15 +3115,15 @@ RSCT_IFD_RESULT CCCIDReader::IfdVendor(uint32_t IoCtrlCode,uint8_t *Input,uint32
case CJPCSC_VEN_IOCTRL_VERIFY_PIN_DIRECT:
if(InputLength<sizeof(PIN_VERIFY_STRUCTURE))
return STATUS_INVALID_BUFFER_SIZE;
- if(InputLength!=sizeof(PIN_VERIFY_STRUCTURE)-sizeof(uint8_t)+((PIN_VERIFY_STRUCTURE *)Input)->ulDataLength)
+ if(InputLength!=sizeof(PIN_VERIFY_STRUCTURE)-sizeof(PIN_VERIFY_STRUCTURE::abData)+((PIN_VERIFY_STRUCTURE *)Input)->ulDataLength)
return STATUS_INVALID_BUFFER_SIZE;
return IfdVerifyPinDirect((PIN_VERIFY_STRUCTURE *)Input,Output,OutputLength);
case CJPCSC_VEN_IOCTRL_MODIFY_PIN_DIRECT:
if(InputLength<sizeof(PIN_MODIFY_STRUCTURE))
return STATUS_INVALID_BUFFER_SIZE;
- if(InputLength!=sizeof(PIN_MODIFY_STRUCTURE)-sizeof(uint8_t)+((PIN_MODIFY_STRUCTURE *)Input)->ulDataLength)
- return STATUS_INVALID_BUFFER_SIZE;
+ if(InputLength!=sizeof(PIN_MODIFY_STRUCTURE)-sizeof(PIN_MODIFY_STRUCTURE::abData)+((PIN_MODIFY_STRUCTURE *)Input)->ulDataLength)
+ return STATUS_INVALID_BUFFER_SIZE;
return IfdModifyPinDirect((PIN_MODIFY_STRUCTURE *)Input,Output,OutputLength);
case CJPCSC_VEN_IOCTRL_SET_NORM:
if(InputLength<1)
diff --git a/cjeca32/stdafx.h b/cjeca32/stdafx.h
index 7149946..87c78f8 100644
--- a/cjeca32/stdafx.h
+++ b/cjeca32/stdafx.h
@@ -57,6 +57,12 @@
#include "cjeca32.h"
#include "PCSC10.h"
+#ifdef OS_LINUX
+#include <PCSC/reader.h>
+#else
+#include "PCSC10.h"
+#endif
+
#include "Debug.h"
#include "RSCTCriticalSection.h"
#include "BaseCommunication.h"
diff --git a/doc/verifypin_ascii.c b/doc/verifypin_ascii.c
index c41d97b..c27caba 100644
--- a/doc/verifypin_ascii.c
+++ b/doc/verifypin_ascii.c
@@ -330,7 +330,7 @@ int main(int argc, char *argv[])
pin_verify -> abData[offset++] = 0x20; /* '\0' */
pin_verify -> ulDataLength = htonl(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 - sizeof(PIN_VERIFY_STRUCTURE::abData); /* because PIN_VERIFY_STRUCTURE may contain the first byte of abData[] */
printf(" command:");
for (i=0; i<length; i++)
@@ -463,7 +463,7 @@ int main(int argc, char *argv[])
pin_modify -> abData[offset++] = 0x30; /* '0' */
pin_modify -> ulDataLength = HOST_TO_CCID_32(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 -sizeof(PIN_MODIFY_STRUCTURE::abData); /* because PIN_MODIFY_STRUCTURE may contain the first byte of abData[] */;
printf(" command:");
for (i=0; i<length; i++)
diff --git a/doc/verifypin_fpin2.c b/doc/verifypin_fpin2.c
index 4ee4362..c4bc9c1 100644
--- a/doc/verifypin_fpin2.c
+++ b/doc/verifypin_fpin2.c
@@ -331,7 +331,7 @@ int main(int argc, char *argv[])
pin_verify -> abData[offset++] = 0xff; /* '\0' */
pin_verify -> ulDataLength = htonl(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 - sizeof(PIN_VERIFY_STRUCTURE::abData); /* because PIN_VERIFY_STRUCTURE may contain the first byte of abData[] */
printf(" command:");
for (i=0; i<length; i++)
@@ -464,7 +464,7 @@ int main(int argc, char *argv[])
pin_modify -> abData[offset++] = 0x30; /* '0' */
pin_modify -> ulDataLength = HOST_TO_CCID_32(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 -sizeof(PIN_MODIFY_STRUCTURE::abData); /* because PIN_MODIFY_STRUCTURE may contain the first byte of abData[] */
printf(" command:");
for (i=0; i<length; i++)