Commit Graph

173 Commits

Author SHA1 Message Date
Martin Fleisz
1e7330b861
Merge pull request #6363 from akallabeth/urbdrc_double_free_fix
[URBDRC] Added return checks for replaced HashTable with ArrayList
2020-08-11 14:33:17 +02:00
akallabeth
786f6bbfe8 Fixed missing async user data extraction from libusb transfer 2020-08-11 14:12:36 +02:00
Armin Novak
93ee13245c Fixed urbdrc server notification of channel close
There was a recursion issue with usb device channel closing and
local redirected device removal.
If the local redirected device is removed due to hotplug events,
the device channel needs to be closed, which in turn checks if
the local device list contains the device. Ensure that the
channel close code is only executed when not called from the
channel side.
2020-08-10 13:40:41 +02:00
akallabeth
dbeaa614d6 Removed channel close in USB channel done after channel is freed 2020-08-10 13:34:30 +02:00
akallabeth
8c859575cf Fixed access to user_data after free 2020-08-10 13:34:30 +02:00
akallabeth
54c92e78e6 Fixed invalid buffer length and duplicated write function. 2020-08-10 13:34:30 +02:00
akallabeth
e7533130a6 Fixed urbdrc arraylist locking 2020-08-10 13:34:30 +02:00
Armin Novak
28bc636d53 Unified streamID read/write 2020-08-10 13:34:30 +02:00
Armin Novak
3ebc71abf3 Replace wHashTable with wArrayList in USB channel
The streamID is not guaranteed to be uniqe, so add all transfers
to a list and remove by checking pointers instead of the streamID
2020-08-10 13:34:30 +02:00
Armin Novak
ea8f93441d Added return checks for HashTable_Add 2020-08-10 13:34:30 +02:00
Armin Novak
57b405ca26 Fixed compilation warnings. 2020-08-10 12:14:11 +02:00
Armin Novak
8cee10319a Fixed urbdrc device path 2020-07-07 10:43:08 +02:00
Armin Novak
6efc72707c Fixed bDeviceClass check in udev_init
Use the proper constant  0xef (Miscellaneous) instead of
0xfe (Application Specific)
See https://www.usb.org/defined-class-codes
2020-07-07 10:43:08 +02:00
akallabeth
bc7d423c6c Replaced malloc in urbdrc channel 2020-07-07 10:43:08 +02:00
akallabeth
804891c0e8 Fixed discrepancy in string descriptor default 2020-07-07 10:43:08 +02:00
akallabeth
37a5a7a157 Replaced memset in urbdrc 2020-07-07 10:43:08 +02:00
akallabeth
29e3b0ea51 Unified logging for urbdrc libusb wrapper 2020-07-07 10:43:08 +02:00
akallabeth
66e4eb628b Initialize variable in func_instance_id_generate 2020-07-07 10:43:08 +02:00
akallabeth
8ee0fafa09 Improved error log for string descriptor read issues 2020-07-07 10:43:08 +02:00
akallabeth
2a493a58a8 Reverted check for short usb descriptor 2020-07-07 10:43:08 +02:00
akallabeth
2d95224488 Added compile time urbdrc debug option 2020-07-07 10:43:08 +02:00
akallabeth
fc8c07435f Dump USB channel data with log-level trace 2020-07-07 10:43:08 +02:00
Armin Novak
ef4de12887 Fixed double free in urb_isoch_transfer_cb 2020-06-03 08:37:45 +02:00
Armin Novak
a5e2d62e48 Do not remove transfer data on usb cancel transfer 2020-06-03 08:24:17 +02:00
Florian Staudacher
d1dc2fb03d report only actual bytes received, not allocated buffer size (interrupt produces data, timeout doesn't) 2020-06-02 09:21:30 +02:00
Florian Staudacher
03128d5154 only call 'libusb_set_interface_alt_setting' when value is changed 2020-05-29 10:48:23 +02:00
akallabeth
b584d07734 Fixed #6197: NULL check in urbdrc 2020-05-20 15:02:24 +02:00
akallabeth
64ad42b95b Fixed DestroyListener arguments and call order 2020-05-13 17:11:17 +02:00
akallabeth
2f5e5359f6 Destroy channel listeners on terminate 2020-05-12 11:40:42 +02:00
akallabeth
52dd312e11 Fixed various input buffer length checks in URBDRC
Thanks to hac425 CVE-2020-11039
2020-05-08 11:04:03 +02:00
akallabeth
9f77fc3dd2 Fixed int overflow in msusb_mspipes_read
Thanks to hac425
2020-05-08 11:04:03 +02:00
akallabeth
5305d62b72 Fix oob read in msusb_msconfig_read 2020-05-06 13:31:57 +02:00
Bernhard Miklautz
3e89574205
Merge pull request #6124 from akallabeth/speedup
Unify inline and some warning fixes
2020-05-05 15:34:38 +02:00
akallabeth
9d014fe1ea Fixed compiler warnings for usb channel 2020-04-27 08:19:42 +02:00
Lukas Fink
0c27cecea4 Fixes null dereference bug
Avoids a null function pointer dereference that happened, when
freerdp_urbdrc_client_subsystem_entry failed before invoking
udevman_load_interface.
2020-04-26 19:09:13 +02:00
Lukas Fink
0cbff94aa9 Implemented udevman->hotplug_vid_pids as wArrayList 2020-04-26 19:09:13 +02:00
Lukas Fink
060253c9fa Added ability to add usb devs via id and addr simultaneously
It is now possible to add usb devices both via vid+pid and via bus+addr
at the same time. To do this, the ids are directly
given to the corresponding command line options:
/usb🆔<vid+pids>,addr:<bus+addrs>
The dev option still works like before: /usb:id,dev:<vid+pids> or
/usb:addr,dev:<bus+addrs>
2020-04-26 19:09:13 +02:00
Lukas Fink
0a5d0312d5 Added hotplug to /usb:id,dev option
Devices specified with the /usb:id,dev command line option are now
detected by the hotplug callback.
2020-04-26 19:09:13 +02:00
Lukas Fink
3d3cec4dc4 Fixed /usb:dev command line option
The /usb:dev command line option failed silently, because it tried to add the
devices before urbdrc gets initialized. This commit adds a new function
to udevman, that gets called when the urbdrc addin is initialized.
Registering of the given devices is now performed there.
2020-04-26 19:09:13 +02:00
akallabeth
c6666731d2 Removed casts in udevman_parse_device_id_addr 2020-04-21 08:05:06 +02:00
Lukas Fink
be884c2bf6 Refactored parsing of usb dev: command line option
Refactored urbdrc_udevman_register_devices with its helper functions,
because the old implementation was a bit quirky. Removed a unsafe
strcpy, that led to a buffer overflow when given misonstructed command
line options. Doing something like "/usb:id,dev🔢1234##abcd:abcd"
won't work anymore, too.
2020-04-21 08:05:06 +02:00
jacobopantoja
0f8437d1d8 Restrict USBDK to Windows builds
This commit restricts ebdaea6f3b to just Win32 builds
2020-04-11 09:04:29 +02:00
akallabeth
aa39e08c29 Fixed URBDRC DEVICE_ADD_FLAG definitions 2020-04-10 14:16:19 +02:00
akallabeth
42d40261c5 Fixed return type for subsystem entry 2020-04-10 14:11:15 +02:00
akallabeth
de7ea07a3d Fixed URBDRC parsing error reported in #6024. 2020-04-09 18:00:51 +02:00
Armin Novak
c58db76e4c Fixed return check for usbdk backend. 2020-03-09 16:40:07 +01:00
Armin Novak
95522923ba Move libusb hotplug registration to polling thread.
* libusb polling thread now is responsible for hotplug registration
  and removal as well as cleanup.
* Only register hotplug callback on systems with support.
2020-03-06 12:07:22 +01:00
Armin Novak
ebdaea6f3b enable usbdk on windows. 2020-03-06 12:07:22 +01:00
Armin Novak
e867ad3c9d Fixed compilation issues against libusb on windows 2020-03-06 12:07:22 +01:00
Armin Novak
34498d4064 URBDRC: Only mark closed if control is closed. 2020-03-03 11:15:34 +01:00