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

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Tue Jan 24 09:52:00 UTC 2012


Author: rousseau
Date: Tue Jan 24 09:51:59 2012
New Revision: 6193

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=6193
Log:
Use an internal pcsc_stringify_error() by default

If the loading of the PCSC library fails all the functions are set to
use internal_error().
The only expection is now pcsc_stringify_error() because the return
value is not a LONG error code but a C-string.

This change fixes a crash when the application called printf() to
display the "string" returned by pcsc_stringify_error() if
SCardEstablishContext() failed in the spying library.

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=6193&op=diff
==============================================================================
--- trunk/PCSC/src/spy/libpcscspy.c (original)
+++ trunk/PCSC/src/spy/libpcscspy.c Tue Jan 24 09:51:59 2012
@@ -78,6 +78,11 @@
 static LONG internal_error(void)
 {
 	return SCARD_F_INTERNAL_ERROR;
+}
+
+static const char * internal_stringify_error(void)
+{
+	return "No spy pcsc_stringify_error() function";
 }
 
 /* contains pointers to real functions */
@@ -122,7 +127,7 @@
 	.SCardCancel = (p_SCardCancel(*))internal_error,
 	.SCardGetAttrib = (p_SCardGetAttrib(*))internal_error,
 	.SCardSetAttrib = (p_SCardSetAttrib(*))internal_error,
-	.pcsc_stringify_error = (p_pcsc_stringify_error(*))internal_error
+	.pcsc_stringify_error = (p_pcsc_stringify_error(*))internal_stringify_error
 };
 
 #define LOG log_line("%s:%d", __FILE__, __LINE__)




More information about the Pcsclite-cvs-commit mailing list