diff options
author | Chris Dickens <christopher.a.dickens@gmail.com> | 2020-03-16 01:01:51 -0700 |
---|---|---|
committer | Chris Dickens <christopher.a.dickens@gmail.com> | 2020-03-16 01:01:51 -0700 |
commit | 15bd82e9a2935fd4e5c1a9ed83c73d364e92d8ec (patch) | |
tree | dd1c590d17a0f10adfe9ca98b18b7783de3e3efc /libusb/os/haiku_usb_raw.cpp | |
parent | 26b16eb65a61b37b64ce8962b5b7d927c3c54a7d (diff) | |
download | libusb-15bd82e9a2935fd4e5c1a9ed83c73d364e92d8ec.tar.gz |
core: Move parameter validation from backend to core
Some functions (e.g. libusb_set_interface_alt_setting()) do not perform
sufficient parameter validation, leaving the burden on the backend to
catch invalid user input. Much of this validation is common across all
backends, yet not every backend implemented it. Fix this by moving
parameter validation to the core library functions.
This is also a good opportunity to remove the redundant
'num_configurations' field from the libusb_device structure. The value
of this field is already contained in the 'device_descriptor' member.
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
Diffstat (limited to 'libusb/os/haiku_usb_raw.cpp')
-rw-r--r-- | libusb/os/haiku_usb_raw.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libusb/os/haiku_usb_raw.cpp b/libusb/os/haiku_usb_raw.cpp index 3162371..63efc17 100644 --- a/libusb/os/haiku_usb_raw.cpp +++ b/libusb/os/haiku_usb_raw.cpp @@ -97,7 +97,7 @@ haiku_get_config_descriptor(struct libusb_device *device, uint8_t config_index, const usb_configuration_descriptor *config = dev->ConfigurationDescriptor(config_index); if (config == NULL) { usbi_err(DEVICE_CTX(device), "failed getting configuration descriptor"); - return LIBUSB_ERROR_INVALID_PARAM; + return LIBUSB_ERROR_IO; } if (len > config->total_length) { len = config->total_length; |