shithub: riscv

Download patch

ref: 473d12c94fdfbbc0a520e5d72fd19cb487cf7bc1
parent: 0e9a80d129306202e31e9ed253b75b9b06703a86
author: ppatience0 <[email protected]>
date: Fri Jul 5 14:42:15 EDT 2013

nusb: only read 18 bytes for device descriptor

--- a/sys/src/cmd/nusb/lib/dev.c
+++ b/sys/src/cmd/nusb/lib/dev.c
@@ -231,7 +231,7 @@
 int
 loaddevdesc(Dev *d)
 {
-	uchar buf[Ddevlen+255];
+	uchar buf[Ddevlen];
 	int nr;
 	int type;
 	Ep *ep0;
@@ -238,7 +238,7 @@
 
 	type = Rd2h|Rstd|Rdev;
 	nr = sizeof(buf);
-	memset(buf, 0, Ddevlen);
+	memset(buf, 0, nr);
 	if((nr=usbcmd(d, type, Rgetdesc, Ddev<<8|0, 0, buf, nr)) < 0)
 		return -1;
 	/*