[Pcsclite-cvs-commit] r3004 - /trunk/Drivers/ccid/src/commands.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Mon Jun 16 08:35:10 UTC 2008


Author: rousseau
Date: Mon Jun 16 08:35:10 2008
New Revision: 3004

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=3004
Log:
CCID_Receive(): do not crash if the reader firmware is bogus and does
not support chaining for extended APDU.

This is the case for Kobil readers

Modified:
    trunk/Drivers/ccid/src/commands.c

Modified: trunk/Drivers/ccid/src/commands.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/Drivers/ccid/src/commands.c?rev=3004&op=diff
==============================================================================
--- trunk/Drivers/ccid/src/commands.c (original)
+++ trunk/Drivers/ccid/src/commands.c Mon Jun 16 08:35:10 2008
@@ -1283,7 +1283,15 @@
 		length = *rx_length;
 		return_value = IFD_ERROR_INSUFFICIENT_BUFFER;
 	}
-	memcpy(rx_buffer, cmd+10, length);
+
+	/* Kobil firmware bug. No support for chaining */
+	if (length && (NULL == rx_buffer))
+	{
+		DEBUG_CRITICAL2("Nul block expected but got %d bytes", length);
+		return_value = IFD_COMMUNICATION_ERROR;
+	}
+	else
+		memcpy(rx_buffer, cmd+10, length);
 
 	/* Extended case?
 	 * Only valid for RDR_to_PC_DataBlock frames */




More information about the Pcsclite-cvs-commit mailing list