Windows: Fix overflow when handling HID or composite devices
authorPete Batard <pete@akeo.ie>
Tue, 17 Jul 2012 16:36:13 +0000 (17:36 +0100)
committerPete Batard <pete@akeo.ie>
Tue, 17 Jul 2012 19:00:13 +0000 (20:00 +0100)
commite82c677b5f10a966c89f6b58caa1ae4341260527
tree67b8dcdb10e33a59528ab6b5f84ba1d4d34d1e50
parentab1b3843bfd544daa5f907d7b9b4c35dce9411dc
Windows: Fix overflow when handling HID or composite devices

* When libusb_get_device_list() is called mutliple times, the HID device
  path was unconditionally duplicated in the list of device's interfaces.
* Because array boundaries were not checked, this caused overflow and crash.
* This patch adds an out of bound check and also ensures that duplication
  of data, for HID and composite, does not occur
* It also renames the private composite_api_flags to api_flags, as well as
  reorganizes the private attributes
* Bug report and part of the fix provided by Toby Gray
libusb/os/windows_usb.c
libusb/os/windows_usb.h
libusb/version_nano.h