[Pcsclite-cvs-commit] r3011 - /trunk/PCSC/src/winscard_clnt.c
rousseau at users.alioth.debian.org
rousseau at users.alioth.debian.org
Thu Jun 19 14:11:33 UTC 2008
Author: rousseau
Date: Thu Jun 19 14:11:32 2008
New Revision: 3011
URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=3011
Log:
SCardListReaders(): correctly return SCARD_E_INSUFFICIENT_BUFFER if
*pcchReaders is too small
Modified:
trunk/PCSC/src/winscard_clnt.c
Modified: trunk/PCSC/src/winscard_clnt.c
URL: http://svn.debian.org/wsvn/pcsclite/trunk/PCSC/src/winscard_clnt.c?rev=3011&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_clnt.c (original)
+++ trunk/PCSC/src/winscard_clnt.c Thu Jun 19 14:11:32 2008
@@ -3120,6 +3120,15 @@
/* for the last NULL byte */
dwReadersLen += 1;
+
+ /* not enough place to store the reader names */
+ if ((NULL != mszReaders) && (*pcchReaders < dwReadersLen))
+ {
+ rv = SCARD_E_INSUFFICIENT_BUFFER;
+ goto end;
+ }
+
+ /* set the reader names length */
*pcchReaders = dwReadersLen;
if (1 == dwReadersLen)
@@ -3131,12 +3140,6 @@
if ((mszReaders == NULL) /* text array not allocated */
|| (*pcchReaders == 0)) /* size == 0 */
{
- goto end;
- }
-
- if (*pcchReaders < dwReadersLen)
- {
- rv = SCARD_E_INSUFFICIENT_BUFFER;
goto end;
}
More information about the Pcsclite-cvs-commit
mailing list