When printing an USB string descriptor using pdesc/pstring, strings have one additional character at the end. In pstring(/sys/src/cmd/usb/lib/dump.c:297) the descriptor length in buf[0] is interpreted as the number of bytes in the following Unicode string, but, compared to the spec, this is two bytes (or one Rune) too much. Apparently buf[0] is `the number of bytes within the string + 2' (for descriptor length and type). The patch tries to fix it by reducing `n' by 2 before using it. Reference: /n/sources/patch/applied/libusb-fix-strlen Date: Fri Oct 13 21:23:17 CES 2006 Signed-off-by: mt@wmipf.in-berlin.de --- /sys/src/cmd/usb/lib/dump.c Fri Oct 13 21:18:58 2006 +++ /sys/src/cmd/usb/lib/dump.c Fri Oct 13 21:18:44 2006 @@ -309,7 +309,7 @@ fprint(2, "illegal count\n"); return; } - n /= 2; + n = (n - 2)/2; rb = (byte*)b + 2; s = malloc(n*UTFmax+1); for(l=0; --n >= 0; rb += 2){