usb/138563: [usb8] [patch] Increase buffer sizes to accomodate longer USB strings

Bruce Cran bruce at cran.org.uk
Sun Sep 6 05:40:01 UTC 2009


>Number:         138563
>Category:       usb
>Synopsis:       [usb8] [patch] Increase buffer sizes to accomodate longer USB strings
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-usb
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Sep 06 05:40:00 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Bruce Cran
>Release:        8.0-BETA4
>Organization:
>Environment:
FreeBSD gluon.draftnet 8.0-BETA4 FreeBSD 8.0-BETA4 #1: Sun Sep  6 06:09:25 BST 2009     brucec at gluon.draftnet:/usr/obj/usr/src/sys/MYKERNEL  i386
>Description:
My USB mouse is detected as:

ums0: <Microsoft Microsoft 3-Button Mouse with I, class 0/0, rev 1.10/3.00, addr 3> on usbus3

The product name stored in the device is "Microsoft 3-Button Mouse with IntelliEye(TM)"

The string gets truncated because the 'temp' buffer in sys/dev/usb/usb_device.c line 2154 only has enough space for 32 wide characters; according to http://msdn.microsoft.com/en-us/library/ms790920.aspx USB allows strings to be up to 126 wide characters.
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

--- usb_device.c.orig	2009-09-06 06:14:44.000000000 +0100
+++ usb_device.c	2009-09-06 06:15:06.000000000 +0100
@@ -2151,7 +2151,7 @@
 #ifdef USB_VERBOSE
 	const struct usb_knowndev *kdp;
 #endif
-	char temp[64];
+	char temp[255];
 	uint16_t vendor_id;
 	uint16_t product_id;
 
--- usb_bus.h.orig	2009-09-06 06:15:12.000000000 +0100
+++ usb_bus.h	2009-09-06 06:15:20.000000000 +0100
@@ -101,7 +101,7 @@
 	union {
 		struct usb_hw_ep_scratch hw_ep_scratch[1];
 		struct usb_temp_setup temp_setup[1];
-		uint8_t	data[128];
+		uint8_t	data[255];
 	}	scratch[1];
 };
 


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-usb mailing list