PERFORCE change 168331 for review

Hans Petter Selasky hselasky at FreeBSD.org
Tue Sep 8 15:40:34 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=168331

Change 168331 by hselasky at hselasky_laptop001 on 2009/09/08 15:39:44

	
	USB CORE:
	 - Correct buffer sizes used so that they match.
	   The old code could give the impression that a possible
	   overflow situation existed. That is not the case.
	
	 - Reported by: Kostik Belousov

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/usb_device.c#54 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/usb_device.c#54 (text+ko) ====

@@ -2359,6 +2359,7 @@
 {
 	char *data = NULL;
 	struct malloc_type *mt;
+	const size_t buf_size = 512;
 
 	mtx_lock(&malloc_mtx);
 	mt = malloc_desc2type("bus");	/* XXX M_BUS */
@@ -2366,12 +2367,12 @@
 	if (mt == NULL)
 		return;
 
-	data = malloc(512, mt, M_NOWAIT);
+	data = malloc(buf_size, mt, M_NOWAIT);
 	if (data == NULL)
 		return;
 
 	/* String it all together. */
-	snprintf(data, 1024,
+	snprintf(data, buf_size,
 	    "%s"
 	    "%s "
 	    "vendor=0x%04x "


More information about the p4-projects mailing list