瀏覽代碼

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>
John Keeping 8 年之前
父節點
當前提交
7715dea48b
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/usb/gadget/f_fastboot.c

+ 1 - 1
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) {