From: John Keeping Date: Mon, 19 Sep 2016 09:59:40 +0000 (+0100) Subject: fastboot: avoid printing invalid data X-Git-Url: http://git.dujemihanovic.xyz/login.html?a=commitdiff_plain;h=7715dea48b5d17f6394d1a02c60a84278df71391;p=u-boot.git 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 Tested-by: Steve Rae --- diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c index aecee7ff38..199621d9f5 100644 --- a/drivers/usb/gadget/f_fastboot.c +++ b/drivers/usb/gadget/f_fastboot.c @@ -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) {