bugfix: transform pace output buffer on usb from little endian to host byte order

git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@211 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
frankmorgner
2010-07-12 12:18:04 +00:00
parent 367afc4406
commit deaf8a8096
3 changed files with 27 additions and 21 deletions

View File

@@ -87,7 +87,7 @@ Index: ccid-1.3.11/src/commands.c
/*****************************************************************************
@@ -691,7 +703,304 @@
@@ -691,7 +703,306 @@
return ret;
} /* SecurePINModify */
@@ -172,8 +172,8 @@ Index: ccid-1.3.11/src/commands.c
+ DEBUG_INFO_XXD("Certificate description:\n", &input[parsed], lengthCertificateDescription);
+ parsed += lengthCertificateDescription;
+
+ if (parsed != input_length) {
+ DEBUG_CRITICAL2("Overrun by %d bytes", input_length - parsed);
+ if (parsed < input_length) {
+ DEBUG_CRITICAL2("Overrun by %u bytes", input_length - parsed);
+ return IFD_COMMUNICATION_ERROR;
+ }
+
@@ -191,7 +191,7 @@ Index: ccid-1.3.11/src/commands.c
+ DEBUG_CRITICAL("Malformed Establish PACE Channel output data.");
+ return IFD_COMMUNICATION_ERROR;
+ }
+ DEBUG_COMM3("MSE:Set AT Statusbytes: %02X %02X",
+ DEBUG_INFO3("MSE:Set AT Statusbytes: %02X %02X",
+ output[parsed+0], output[parsed+1]);
+ parsed += 2;
+
@@ -200,6 +200,7 @@ Index: ccid-1.3.11/src/commands.c
+ return IFD_COMMUNICATION_ERROR;
+ }
+ lengthEF_CardAccess = w2i(output, parsed);
+ memcpy(&output[parsed], &lengthEF_CardAccess, 2);
+ parsed += 2;
+
+ if (parsed+lengthEF_CardAccess > output_length) {
@@ -247,6 +248,7 @@ Index: ccid-1.3.11/src/commands.c
+ return IFD_COMMUNICATION_ERROR;
+ }
+ length_IDicc = w2i(output, parsed);
+ memcpy(&output[parsed], &length_IDicc, 2);
+ parsed += 2;
+
+ if (parsed+length_IDicc > output_length) {
@@ -257,8 +259,8 @@ Index: ccid-1.3.11/src/commands.c
+ DEBUG_INFO_XXD("IDicc:\n", &output[parsed], length_IDicc);
+ parsed += length_IDicc;
+
+ if (parsed != output_length) {
+ DEBUG_CRITICAL2("Overrun by %d bytes", output_length - parsed);
+ if (parsed < output_length) {
+ DEBUG_CRITICAL2("Overrun by %u bytes", output_length - parsed);
+ return IFD_COMMUNICATION_ERROR;
+ }
+
@@ -392,7 +394,7 @@ Index: ccid-1.3.11/src/commands.c
/*****************************************************************************
*
* Escape
@@ -2081,3 +2390,15 @@
@@ -2081,3 +2392,15 @@
buffer[3] = (value >> 24) & 0xFF;
} /* i2dw */