]> git.sur5r.net Git - u-boot/blobdiff - drivers/usb/gadget/f_fastboot.c
Merge branch 'master' of git://git.denx.de/u-boot-mpc85xx
[u-boot] / drivers / usb / gadget / f_fastboot.c
index 3e1c0a9faf29a1aeebb90e466614a7e3760ab619..71b62e5005a12915a164acb74335b4cad6828e4b 100644 (file)
@@ -355,7 +355,7 @@ static void cb_getvar(struct usb_ep *ep, struct usb_request *req)
                !strcmp_l1("max-download-size", cmd)) {
                char str_num[12];
 
-               sprintf(str_num, "%08x", CONFIG_USB_FASTBOOT_BUF_SIZE);
+               sprintf(str_num, "0x%08x", CONFIG_USB_FASTBOOT_BUF_SIZE);
                strncat(response, str_num, chars_left);
        } else if (!strcmp_l1("serialno", cmd)) {
                s = getenv("serial#");
@@ -546,7 +546,14 @@ static void rx_handler_command(struct usb_ep *ep, struct usb_request *req)
                error("unknown command: %s\n", cmdbuf);
                fastboot_tx_write_str("FAILunknown command");
        } else {
-               func_cb(ep, req);
+               if (req->actual < req->length) {
+                       u8 *buf = (u8 *)req->buf;
+                       buf[req->actual] = 0;
+                       func_cb(ep, req);
+               } else {
+                       error("buffer overflow\n");
+                       fastboot_tx_write_str("FAILbuffer overflow");
+               }
        }
 
        if (req->status == 0) {