fastboot: avoid printing invalid data
There is no guarantee that commands are null-terminated in the USB
request buffer, so limit the length of data that is printed.
Signed-off-by: John Keeping <john@metanate.com>
Tested-by: Steve Rae <steve.rae@raedomain.com>
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index aecee7f..199621d 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -718,7 +718,7 @@
}
if (!func_cb) {
- error("unknown command: %s", cmdbuf);
+ error("unknown command: %.*s", req->actual, cmdbuf);
fastboot_tx_write_str("FAILunknown command");
} else {
if (req->actual < req->length) {