[Pcsclite-cvs-commit] r3124 - /trunk/PCSC/src/winscard_clnt.c

rousseau at users.alioth.debian.org rousseau at users.alioth.debian.org
Thu Sep 11 12:05:48 UTC 2008


Author: rousseau
Date: Thu Sep 11 12:05:47 2008
New Revision: 3124

URL: http://svn.debian.org/wsvn/pcsclite/?sc=1&rev=3124
Log:
SCardStatus(), SCardGetAttrib(), SCardListReaders(),
SCardListReaderGroups(): check that the pointer argument used to store
the allocated memory in case of SCARD_AUTOALLOCATE is not NULL.

return SCARD_E_INVALID_PARAMETER instead of crashing

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=3124&op=diff
==============================================================================
--- trunk/PCSC/src/winscard_clnt.c (original)
+++ trunk/PCSC/src/winscard_clnt.c Thu Sep 11 12:05:47 2008
@@ -1645,6 +1645,11 @@
 			rv = SCARD_E_NO_MEMORY;
 			goto end;
 		}
+		if (NULL == mszReaderName)
+		{
+			rv = SCARD_E_INVALID_PARAMETER;
+			goto end;
+		}
 		*(char **)mszReaderName = bufReader;
 	}
 	else
@@ -1668,6 +1673,11 @@
 		if (NULL == bufAtr)
 		{
 			rv = SCARD_E_NO_MEMORY;
+			goto end;
+		}
+		if (NULL == pbAtr)
+		{
+			rv = SCARD_E_INVALID_PARAMETER;
 			goto end;
 		}
 		*(LPBYTE *)pbAtr = bufAtr;
@@ -2611,6 +2621,9 @@
 		if (NULL == buf)
 			return SCARD_E_NO_MEMORY;
 
+		if (NULL == pbAttr)
+			return SCARD_E_INVALID_PARAMETER;
+
 		*(unsigned char **)pbAttr = buf;
 	}
 	else
@@ -3195,6 +3208,11 @@
 			rv = SCARD_E_NO_MEMORY;
 			goto end;
 		}
+		if (NULL == mszReaders)
+		{
+			rv = SCARD_E_INVALID_PARAMETER;
+			goto end;
+		}
 		*(char **)mszReaders = buf;
 	}
 	else
@@ -3362,6 +3380,11 @@
 		if (NULL == buf)
 		{
 			rv = SCARD_E_NO_MEMORY;
+			goto end;
+		}
+		if (NULL == mszGroups)
+		{
+			rv = SCARD_E_INVALID_PARAMETER;
 			goto end;
 		}
 		*(char **)mszGroups = buf;




More information about the Pcsclite-cvs-commit mailing list