[Pcsclite-cvs-commit] r6653 - /trunk/PCSC/src/winscard.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Mon Jun 10 12:21:32 UTC 2013


Author: rousseau
Date: Mon Jun 10 12:21:32 2013
New Revision: 6653

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=6653
Log:
SCardGetAttrib(): Fix bug in SCARD_ATTR_DEVICE_FRIENDLY_NAME

Affect the real length _after_ checking the buffer is large enough.

Thanks to Rafael Ugalde Beriain for the bug report.

Modified:
    trunk/PCSC/src/winscard.c

Modified: trunk/PCSC/src/winscard.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard.c?rev=6653&op=diff
==============================================================================
--- trunk/PCSC/src/winscard.c (original)
+++ trunk/PCSC/src/winscard.c Mon Jun 10 12:21:32 2013
@@ -1394,15 +1394,15 @@
 			{
 				unsigned int len = strlen(rContext->readerState->readerName)+1;
 
-				*pcbAttrLen = len;
 				if (len > *pcbAttrLen)
 					rv = SCARD_E_INSUFFICIENT_BUFFER;
 				else
 				{
 					(void)strlcpy((char *)pbAttr,
-						rContext->readerState->readerName, *pcbAttrLen);
+						rContext->readerState->readerName, len);
 					rv = SCARD_S_SUCCESS;
 				}
+				*pcbAttrLen = len;
 
 			}
 			else




More information about the Pcsclite-cvs-commit mailing list