Plan 9 from Bell Labs’s /usr/web/sources/patch/applied/libusb-fix-strlen/readme

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


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.

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].