[Pcsclite-cvs-commit] PCSC/src hotplug_macosx.c,1.14,1.15

rousseau@quantz.debian.org rousseau@quantz.debian.org
Thu, 08 Jan 2004 16:24:57 +0100


Update of /cvsroot/pcsclite/PCSC/src
In directory quantz:/tmp/cvs-serv9434/PCSC/src

Modified Files:
	hotplug_macosx.c 
Log Message:
buffer overflow: the driver list was not terminated and caused crashes.


Index: hotplug_macosx.c
===================================================================
RCS file: /cvsroot/pcsclite/PCSC/src/hotplug_macosx.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- hotplug_macosx.c	21 Oct 2003 20:47:22 -0000	1.14
+++ hotplug_macosx.c	8 Jan 2004 15:24:55 -0000	1.15
@@ -3,7 +3,7 @@
  *
  * MUSCLE SmartCard Development ( http://www.linuxnet.com )
  *
- * Copyright (C) 2002
+ * Copyright (C) 2002-2004
  *  Stephen M. Webb <stephenw@cryptocard.com>
  *  Ludovic Rousseau <ludovic.rousseau@free.fr>
  *  David Corcoran <corcoran@linuxnet.com>
@@ -164,6 +164,11 @@
 #ifdef DEBUG_HOTPLUG
 	DebugLogB("Total of %d readers supported", readersNumber);
 #endif
+
+	/* The last entry is an end marker (m_vendorId = 0)
+	 * see checks in HPDriversMatchUSBDevices:503
+	 *  and HPDriverVectorRelease:376 */
+	readersNumber++;
 
 	bundleVector = (HPDriver *) calloc(readersNumber, sizeof(HPDriver));
 	if (!bundleVector)