From 78eb865b31436f2cb023c95078fbb99b32942faf Mon Sep 17 00:00:00 2001 From: Tormod Volden Date: Mon, 1 Nov 2021 23:40:44 +0100 Subject: [PATCH] descriptor: Provide more detailed warning if suspicious bLength Signed-off-by: Tormod Volden --- libusb/descriptor.c | 4 ++-- libusb/version_nano.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libusb/descriptor.c b/libusb/descriptor.c index 10e0570..253ef1c 100644 --- a/libusb/descriptor.c +++ b/libusb/descriptor.c @@ -1109,7 +1109,7 @@ int API_EXPORTED libusb_get_string_descriptor_ascii(libusb_device_handle *dev_ha else if (str.desc.bDescriptorType != LIBUSB_DT_STRING) return LIBUSB_ERROR_IO; else if (str.desc.bLength & 1) - usbi_warn(HANDLE_CTX(dev_handle), "suspicious bLength %u for string descriptor", str.desc.bLength); + usbi_warn(HANDLE_CTX(dev_handle), "suspicious bLength %u for language ID string descriptor", str.desc.bLength); langid = libusb_le16_to_cpu(str.desc.wData[0]); r = libusb_get_string_descriptor(dev_handle, desc_index, langid, str.buf, sizeof(str.buf)); @@ -1120,7 +1120,7 @@ int API_EXPORTED libusb_get_string_descriptor_ascii(libusb_device_handle *dev_ha else if (str.desc.bDescriptorType != LIBUSB_DT_STRING) return LIBUSB_ERROR_IO; else if ((str.desc.bLength & 1) || str.desc.bLength != r) - usbi_warn(HANDLE_CTX(dev_handle), "suspicious bLength %u for string descriptor", str.desc.bLength); + usbi_warn(HANDLE_CTX(dev_handle), "suspicious bLength %u for string descriptor (read %d)", str.desc.bLength, r); di = 0; for (si = 2; si < str.desc.bLength; si += 2) { diff --git a/libusb/version_nano.h b/libusb/version_nano.h index bb7f8c0..d14e227 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11668 +#define LIBUSB_NANO 11669 -- 2.34.1