summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Dickens <christopher.a.dickens@gmail.com>2018-03-12 10:28:40 -0700
committerChris Dickens <christopher.a.dickens@gmail.com>2018-03-12 10:28:40 -0700
commitd236b63e81d2e92fc86181a4d147dbde38a8ac31 (patch)
tree17213c15a175c449170f376b96200e0b4d8a3797
parent76b0677b14beda38ca4e553dec7818bf79152b48 (diff)
downloadlibusb-d236b63e81d2e92fc86181a4d147dbde38a8ac31.tar.gz
Windows: WinUSB: Guard against erroneous reporting of devices
During enumeration, obtaining the port number via SPDRP_ADDRESS might return a bogus value for some third-party HCD drivers. If this occurs, we might end up reporting the device as having the VID/PID from the last successful enumeration. Guard against this particular situation by clearing the USB_NODE_CONNECTION_INFORMATION_EX structure before issuing the DeviceIoControl() call. References #403 Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
-rw-r--r--libusb/os/windows_winusb.c1
-rw-r--r--libusb/version_nano.h2
2 files changed, 2 insertions, 1 deletions
diff --git a/libusb/os/windows_winusb.c b/libusb/os/windows_winusb.c
index 9927115..1783700 100644
--- a/libusb/os/windows_winusb.c
+++ b/libusb/os/windows_winusb.c
@@ -857,6 +857,7 @@ static int init_device(struct libusb_device *dev, struct libusb_device *parent_d
return LIBUSB_ERROR_ACCESS;
}
+ memset(&conn_info, 0, sizeof(conn_info));
conn_info.ConnectionIndex = (ULONG)port_number;
// coverity[tainted_data_argument]
if (!DeviceIoControl(hub_handle, IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX, &conn_info, sizeof(conn_info),
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index 1adf635..92f2e78 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 11305
+#define LIBUSB_NANO 11306