[Pcsclite-cvs-commit] r6194 - /trunk/PCSC/src/spy/libpcscspy.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Tue Jan 24 10:00:13 UTC 2012


Author: rousseau
Date: Tue Jan 24 10:00:12 2012
New Revision: 6194

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=6194
Log:
load_lib(): check dlsym() return correct values

If the pointer returned by dlsym("SCardEstablishContext") is our own
SCardEstablishContext() function then we will finish in a endless
recursion. Something went wrong and we stop immediatly instead of
crashing when the call stack is full.

Modified:
    trunk/PCSC/src/spy/libpcscspy.c

Modified: trunk/PCSC/src/spy/libpcscspy.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/spy/libpcscspy.c?rev=6194&op=diff
==============================================================================
--- trunk/PCSC/src/spy/libpcscspy.c (original)
+++ trunk/PCSC/src/spy/libpcscspy.c Tue Jan 24 10:00:12 2012
@@ -344,6 +344,12 @@
 
 #define get_symbol(s) do { spy.s = dlsym(Lib_handle, #s); if (NULL == spy.s) { log_line("%s", dlerror()); return SCARD_F_INTERNAL_ERROR; } } while (0)
 
+	if (SCardEstablishContext == dlsym(Lib_handle, "SCardEstablishContext"))
+	{
+		log_line("Symbols dlsym error");
+		return SCARD_F_INTERNAL_ERROR;
+	}
+
 	get_symbol(SCardEstablishContext);
 	get_symbol(SCardReleaseContext);
 	get_symbol(SCardIsValidContext);




More information about the Pcsclite-cvs-commit mailing list