[Pcsclite-cvs-commit] r2482 - trunk/PCSC/src

Ludovic Rousseau rousseau at alioth.debian.org
Thu Mar 15 09:29:15 CET 2007


Author: rousseau
Date: 2007-03-15 08:29:14 +0000 (Thu, 15 Mar 2007)
New Revision: 2482

Modified:
   trunk/PCSC/src/winscard_msg.c
Log:
WrapSHMWrite(): clean the data buffer for SCardTransmit() to clean the
APDU buffer to remove any possible PIN or secret value

Thanks to Nils Larsch for the patch


Modified: trunk/PCSC/src/winscard_msg.c
===================================================================
--- trunk/PCSC/src/winscard_msg.c	2007-03-15 08:23:07 UTC (rev 2481)
+++ trunk/PCSC/src/winscard_msg.c	2007-03-15 08:29:14 UTC (rev 2482)
@@ -414,17 +414,13 @@
 		memcpy(msgStruct.data, data, PCSCLITE_MAX_MESSAGE_SIZE);
 		ret = SHMMessageSend(&msgStruct, sizeof(msgStruct), dwClientID,
 			blockAmount);
-		if (ret)
-			return ret;
 
 		/* do not send an empty second block */
-		if (size > PCSCLITE_MAX_MESSAGE_SIZE)
+		if ((0 == ret) && (size > PCSCLITE_MAX_MESSAGE_SIZE))
 		{
 			/* second block */
 			ret = SHMMessageSend(data+PCSCLITE_MAX_MESSAGE_SIZE,
 				size-PCSCLITE_MAX_MESSAGE_SIZE, dwClientID, blockAmount);
-			if (ret)
-				return ret;
 		}
 	}
 	else
@@ -434,6 +430,11 @@
 		ret = SHMMessageSend(&msgStruct, sizeof(msgStruct), dwClientID,
 			blockAmount);
 	}
+
+	if (SCARD_TRANSMIT == command)
+		/* clean APDU buffer to remove any possible PIN or secret value */
+		memset(msgStruct.data, 0, min(size, PCSCLITE_MAX_MESSAGE_SIZE));
+
 	return ret;
 }
 




More information about the Pcsclite-cvs-commit mailing list