[Pcsclite-git-commit] [CCID] 01/01: IFDHGetCapabilities: fix SCARD_ATTR_VENDOR_IFD_SERIAL_NO size

Ludovic Rousseau rousseau at moszumanska.debian.org
Fri May 20 16:11:59 UTC 2016


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

rousseau pushed a commit to branch master
in repository CCID.

commit b4c2cae5f311eef313777124937520c780d002fd
Author: Ludovic Rousseau <ludovic.rousseau at free.fr>
Date:   Fri May 20 15:19:05 2016 +0200

    IFDHGetCapabilities: fix SCARD_ATTR_VENDOR_IFD_SERIAL_NO size
    
    We use strlcpy() to copy the IFD (reader) serial number string. So we
    must must take into account the terminating NUL byte.
    
    Without the patch the size was "correctly" reported on the first call
    (without including the final NUL byte). So the application allocates a
    buffer for this size and the next strlcpy() tuncates the string to add
    the NUL byte.
    
    Thanks to Daniel Kucera for the bug report.
---
 src/ifdhandler.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ifdhandler.c b/src/ifdhandler.c
index 207157e..3e4f4ad 100644
--- a/src/ifdhandler.c
+++ b/src/ifdhandler.c
@@ -596,7 +596,7 @@ EXTERNAL RESPONSECODE IFDHGetCapabilities(DWORD Lun, DWORD Tag,
 				if (ccid_desc->sIFD_serial_number)
 				{
 					strlcpy((char *)Value, ccid_desc->sIFD_serial_number, *Length);
-					*Length = strlen((char *)Value);
+					*Length = strlen((char *)Value)+1;
 				}
 				else
 				{

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



More information about the Pcsclite-cvs-commit mailing list