components/ccid/patches/02-commands.c.patch
author Petr Sumbera <petr.sumbera@oracle.com>
Wed, 05 Oct 2016 01:21:05 -0700
branchs11u3-sru
changeset 7090 49c102d793d0
parent 6362 94df57e11df8
permissions -rw-r--r--
24698806 Upgrade Thunderbird to version 45.3.0 24802000 problem in TBIRD/MAILER
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6362
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
     1
In-house patch created for CCID data frame error handling issue seen on Solaris.
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
     2
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
     3
The data the CCID frame says to contain will only be evaluated to see if we 
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
     4
have less data, if so then report it as an error condition. 
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
     5
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
     6
--- ccid-1.4.20/src/commands.c	2016-05-17 10:28:40.587856908 -0400
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
     7
+++ ccid-1.4.20/src/commands.c	2016-05-17 10:04:27.530080977 -0400
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
     8
@@ -1493,6 +1493,8 @@
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
     9
 	length = sizeof(cmd);
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    10
 	ret = ReadPort(reader_index, &length, cmd);
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    11
 
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    12
+        DEBUG_CRITICAL2("LENGTH 1 is: %d ", length);
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    13
+
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    14
 	/* restore the original value of read timeout */
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    15
 	ccid_descriptor -> readTimeout = old_timeout;
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    16
 	CHECK_STATUS(ret)
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    17
@@ -1543,12 +1545,21 @@
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    18
 		DEBUG_COMM2("New timeout: %d ms", ccid_descriptor -> readTimeout);
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    19
 		goto time_request;
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    20
 	}
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    21
-
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    22
-	/* we have read less (or more) data than the CCID frame says to contain */
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    23
-	if (length-10 != dw2i(cmd, 1))
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    24
+        /****************************************************************************
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    25
+	  * we have read less (or more) data than the CCID frame says to contain       
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    26
+         * XXX - Change from original FOSS if test logic of "!=" due to line 1493     
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    27
+         *       'length' getting assigned a value of 65636 and 'cmd' appears to be     
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    28
+         *       evaluated and returned from 'sizeof' as an unsigned int, therefore         
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    29
+         *       (65536 -10) will never equal the data the CCID frame says to contain 
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    30
+         *       so, only evaluate to see if we have less data as an error condition. 
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    31
+         ****************************************************************************/
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    32
+       if (length-10 < dw2i(cmd, 1))
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    33
 	{
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    34
 		DEBUG_CRITICAL3("Can't read all data (%d out of %d expected)",
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    35
 			length-10, dw2i(cmd, 1));
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    36
+
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    37
+                DEBUG_CRITICAL2("LENGTH 2 is: %d ", length);
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    38
+
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    39
 		return_value = IFD_COMMUNICATION_ERROR;
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    40
 	}
94df57e11df8 PSARC/2016/217 Smartcard Reintroduction
Jan Parcel <jan.parcel@oracle.com>
parents:
diff changeset
    41