Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Sep 2009 15:40:33 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 168331 for review
Message-ID:  <200909081540.n88FeXee068332@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=168331

Change 168331 by hselasky@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 "



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200909081540.n88FeXee068332>