aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-01-18 21:49:31 +0100
committerHarald Welte <laforge@osmocom.org>2020-01-18 21:50:47 +0100
commite51cbe4cc7db6daf388a5dfb2c889b4070a57b6a (patch)
tree979c174ec8130b315941d333aebf7de6531f9ed4 /src
parentc45787bf5c47c1f16360ad5843fb6cc6c5118384 (diff)
osmo_libusb: Check return of libusb_get_string_descriptor_ascii()HEADmaster
Change-Id: Ifc0133737627a8277635f8f3662b3f6e922be149 Closes: CID#207713
Diffstat (limited to 'src')
-rw-r--r--src/usb/osmo_libusb.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/usb/osmo_libusb.c b/src/usb/osmo_libusb.c
index 9ad62403..7a13a7e3 100644
--- a/src/usb/osmo_libusb.c
+++ b/src/usb/osmo_libusb.c
@@ -334,6 +334,12 @@ libusb_device *osmo_libusb_find_matching_dev_serial(struct libusb_context *luctx
}
rc = libusb_get_string_descriptor_ascii(devh, dev_desc.iSerialNumber,
(uint8_t *) strbuf, sizeof(strbuf));
+ if (rc < 0) {
+ LOGP(DLUSB, LOGL_ERROR, "Cannot read USB Descriptor: %s\n",
+ libusb_strerror(rc));
+ libusb_close(devh);
+ continue;
+ }
libusb_close(devh);
if (strcmp(strbuf, serial))
continue;