Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(495)

Unified Diff: components/usb_service/usb_device_handle.cc

Issue 252153002: Fix chrome.usb control transfer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/usb_service/usb_device_handle.cc
diff --git a/components/usb_service/usb_device_handle.cc b/components/usb_service/usb_device_handle.cc
index e9b9fcce7df75a4c1ba04854adb734459c32a8a9..b341368955649560207665ce7148cdee61ff9fb9 100644
--- a/components/usb_service/usb_device_handle.cc
+++ b/components/usb_service/usb_device_handle.cc
@@ -234,8 +234,7 @@ void UsbDeviceHandle::TransferComplete(PlatformUsbTransferHandle handle) {
CHECK(transfer.length >= LIBUSB_CONTROL_SETUP_SIZE)
<< "buffer was not correctly set: too small for the control header";
- if (transfer.length >= actual_length &&
- actual_length >= LIBUSB_CONTROL_SETUP_SIZE) {
+ if (transfer.length >= (LIBUSB_CONTROL_SETUP_SIZE + actual_length)) {
// If the payload is zero bytes long, pad out the allocated buffer
// size to one byte so that an IOBuffer of that size can be allocated.
scoped_refptr<net::IOBuffer> resized_buffer =
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698