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

Unified Diff: device/hid/hid_connection.cc

Issue 943783003: Pad HID output reports on Windows to the maximum output report size. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | device/hid/hid_connection_win.cc » ('j') | device/hid/hid_connection_win.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/hid/hid_connection.cc
diff --git a/device/hid/hid_connection.cc b/device/hid/hid_connection.cc
index 6ce2d7fd0024b20fbab5ad50647613f54500188e..c43667a2fc035299600958d1106cf8266804f044 100644
--- a/device/hid/hid_connection.cc
+++ b/device/hid/hid_connection.cc
@@ -99,6 +99,12 @@ void HidConnection::Write(scoped_refptr<net::IOBuffer> buffer,
callback.Run(false);
return;
}
+ if (size > device_info_->max_output_report_size() + 1) {
+ VLOG(1) << "Output report buffer too long (" << size << " > "
+ << (device_info_->max_output_report_size() + 1) << ").";
+ callback.Run(false);
+ return;
+ }
DCHECK_GE(size, 1u);
uint8_t report_id = buffer->data()[0];
if (device_info_->has_report_id() != (report_id != 0)) {
« no previous file with comments | « no previous file | device/hid/hid_connection_win.cc » ('j') | device/hid/hid_connection_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698