[Pcsclite-git-commit] [PCSC] 01/04: Correctly display SCARD_ATTR_VENDOR_IFD_VERSION attribute

Ludovic Rousseau rousseau at moszumanska.debian.org
Fri Jun 26 15:39:55 UTC 2015


This is an automated email from the git hooks/post-receive script.

rousseau pushed a commit to branch master
in repository PCSC.

commit 459497acacf92c08183d47ea4fbc459476b3d4f4
Author: Ludovic Rousseau <ludovic.rousseau at gmail.com>
Date:   Fri Jun 26 10:17:50 2015 +0200

    Correctly display SCARD_ATTR_VENDOR_IFD_VERSION attribute
    
    The API documentation says about SCARD_ATTR_VENDOR_IFD_VERSION:
    Vendor-supplied interface device version (DWORD in the form 0xMMmmbbbb
    where MM = major version, mm = minor version, and bbbb = build number).
    
    But the CCID driver uses a fixed size of 4 bytes and type uint32_t to
    store the result.
    It works on 32-bits system but is wrong on some 64-bits systems (GNU Linux,
    not Mac OS X).
    
    On systems with sizeof(DWORD) = 64 the display of the value was
    incorrect.
---
 src/testpcsc.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/testpcsc.c b/src/testpcsc.c
index 064686b..322c565 100644
--- a/src/testpcsc.c
+++ b/src/testpcsc.c
@@ -373,8 +373,18 @@ wait_for_card_again:
 	rv = SCardGetAttrib(hCard, SCARD_ATTR_VENDOR_IFD_VERSION, buf.as_char, &dwBufLen);
 	test_rv(rv, hContext, DONT_PANIC);
 	if (rv == SCARD_S_SUCCESS)
-		printf("Vendor IFD version\t\t: " GREEN "0x%08lX\n" NORMAL,
-			buf.as_DWORD);
+	{
+		printf("Vendor IFD version\t\t: ");
+		if (dwBufLen == sizeof(DWORD))
+			printf(GREEN "0x%08lX\n" NORMAL, buf.as_DWORD);
+		else
+		{
+			if (dwBufLen == sizeof(uint32_t))
+				printf(GREEN "0x%08X\n" NORMAL, buf.as_uint32_t);
+			else
+				printf(RED "Unsupported size\n" NORMAL);
+		}
+	}
 
 	printf("Testing SCardGetAttrib\t\t: ");
 	dwBufLen = sizeof(buf);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pcsclite/PCSC.git



More information about the Pcsclite-cvs-commit mailing list