]> git.sur5r.net Git - u-boot/commitdiff
fastboot: avoid printing invalid data
authorJohn Keeping <john@metanate.com>
Mon, 19 Sep 2016 09:59:40 +0000 (10:59 +0100)
committerMarek Vasut <marex@denx.de>
Mon, 21 Aug 2017 09:31:10 +0000 (11:31 +0200)
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>
drivers/usb/gadget/f_fastboot.c

index aecee7ff3803ba6a7304eb84ace9fb10d60623f8..199621d9f5407fa09da890f7b4e68041583b06fa 100644 (file)
@@ -718,7 +718,7 @@ static void rx_handler_command(struct usb_ep *ep, struct usb_request *req)
        }
 
        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) {