diff options
author | Dave Camarillo <dave.camarillo@gmail.com> | 2011-09-23 11:56:58 +0100 |
---|---|---|
committer | Peter Stuge <peter@stuge.se> | 2012-02-08 14:46:17 +0100 |
commit | f6ef0fca4b36657c1a0885c18cc4c4afcb4f7339 (patch) | |
tree | d8191988aa39b6ba231c2a24e55965ff214f40dd | |
parent | e280760331e8b39ad3530235653644654166b322 (diff) | |
download | libusb-f6ef0fca4b36657c1a0885c18cc4c4afcb4f7339.tar.gz |
Windows: Fix crash during enumeration with >= 64 connected devices
* indexes were outgrowing the unref_list array before realloc,
resulting in out of bound access and crash.
-rw-r--r-- | libusb/os/windows_usb.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c index dcc7e7f..4d4c92c 100644 --- a/libusb/os/windows_usb.c +++ b/libusb/os/windows_usb.c @@ -1421,7 +1421,7 @@ static int windows_get_device_list(struct libusb_context *ctx, struct discovered windows_device_priv_init(dev); // Keep track of devices that need unref unref_list[unref_cur++] = dev; - if (unref_cur > unref_size) { + if (unref_cur >= unref_size) { unref_size += 64; unref_list = realloc(unref_list, unref_size*sizeof(libusb_device*)); if (unref_list == NULL) { |