mirror of
https://github.com/RPCS3/hidapi.git
synced 2026-07-19 21:43:36 -04:00
Guard against zero length buffers in hid_write (#279)
This commit is contained in:
committed by
GitHub
parent
fc8fdd2bf4
commit
7620bc7faa
+7
-1
@@ -1043,9 +1043,15 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path)
|
||||
int HID_API_EXPORT hid_write(hid_device *dev, const unsigned char *data, size_t length)
|
||||
{
|
||||
int res;
|
||||
int report_number = data[0];
|
||||
int report_number;
|
||||
int skipped_report_id = 0;
|
||||
|
||||
if (!data || (length ==0)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
report_number = data[0];
|
||||
|
||||
if (report_number == 0x0) {
|
||||
data++;
|
||||
length--;
|
||||
|
||||
Reference in New Issue
Block a user