summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2014-08-05 18:18:46 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2014-09-07 17:45:35 +0200
commitd3df564486d7c935bdcf01723b4e04a5af28e1c7 (patch)
treeb33547540a157ea97a659902394c36e0c885fe3a /utils
parentdd05dc76a45718ad327d3fec69c259b873c39154 (diff)
downloadrockbox-d3df564486d7c935bdcf01723b4e04a5af28e1c7.tar.gz
rockbox-d3df564486d7c935bdcf01723b4e04a5af28e1c7.tar.bz2
rockbox-d3df564486d7c935bdcf01723b4e04a5af28e1c7.zip
hwstub: fix horrible bug
Change-Id: I8042f692045a23dbb545d840e5169ce4b99fe5d2
Diffstat (limited to 'utils')
-rw-r--r--utils/hwstub/stub/main.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/utils/hwstub/stub/main.c b/utils/hwstub/stub/main.c
index a8d99fc863..e31c5d1b8b 100644
--- a/utils/hwstub/stub/main.c
+++ b/utils/hwstub/stub/main.c
@@ -376,7 +376,6 @@ static void handle_read(struct usb_ctrlrequest *req)
{
if(id != last_id)
return usb_drv_stall(EP_CONTROL, true, true);
- memcpy((void *)last_addr, usb_buffer, req->wLength);
memcpy(usb_buffer, (void *)last_addr, req->wLength);
asm volatile("nop" : : : "memory");
usb_drv_send(EP_CONTROL, usb_buffer, req->wLength);
@@ -392,7 +391,7 @@ static void handle_write(struct usb_ctrlrequest *req)
int sz_hdr = sizeof(struct hwstub_write_req_t);
if(size < sz_hdr)
return usb_drv_stall(EP_CONTROL, true, true);
- memcpy((void *)write->dAddress, usb_buffer + sz_hdr, req->wLength - sz_hdr);
+ memcpy((void *)write->dAddress, usb_buffer + sz_hdr, size - sz_hdr);
usb_drv_send(EP_CONTROL, NULL, 0);
}