[Pcsclite-cvs-commit] r5124 - /trunk/PCSC/src/winscard_svc.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Fri Aug 13 11:51:44 UTC 2010


Author: rousseau
Date: Fri Aug 13 11:51:43 2010
New Revision: 5124

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=5124
Log:
MSGCheckHandleAssociation(): check that the context handle is still
valid. Calling a PC/SC function after SCardReleaseContext() is not
supported.

Modified:
    trunk/PCSC/src/winscard_svc.c

Modified: trunk/PCSC/src/winscard_svc.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard_svc.c?rev=5124&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_svc.c (original)
+++ trunk/PCSC/src/winscard_svc.c Fri Aug 13 11:51:43 2010
@@ -917,6 +917,15 @@
 static LONG MSGCheckHandleAssociation(SCARDHANDLE hCard, SCONTEXT * threadContext)
 {
 	int list_index = 0;
+
+	if (0 == threadContext->hContext)
+	{
+		/* the handle is no more valid. After SCardReleaseContext() for
+		 * example */
+		Log1(PCSC_LOG_CRITICAL, "Invalidated handle");
+		return -1;
+	}
+
 	(void)pthread_mutex_lock(&threadContext->cardsList_lock);
 	list_index = list_locate(&(threadContext->cardsList), &hCard);
 	(void)pthread_mutex_unlock(&threadContext->cardsList_lock);




More information about the Pcsclite-cvs-commit mailing list