Change in libosmocore[master]: osmo_libusb: Check return of libusb_get_string_descriptor_ascii()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Mon Jan 20 11:40:16 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/16927 )

Change subject: osmo_libusb: Check return of libusb_get_string_descriptor_ascii()
......................................................................

osmo_libusb: Check return of libusb_get_string_descriptor_ascii()

Change-Id: Ifc0133737627a8277635f8f3662b3f6e922be149
Closes: CID#207713
---
M src/usb/osmo_libusb.c
1 file changed, 6 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, approved



diff --git a/src/usb/osmo_libusb.c b/src/usb/osmo_libusb.c
index 9ad6240..7a13a7e 100644
--- a/src/usb/osmo_libusb.c
+++ b/src/usb/osmo_libusb.c
@@ -334,6 +334,12 @@
 			}
 			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;

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/16927
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Ifc0133737627a8277635f8f3662b3f6e922be149
Gerrit-Change-Number: 16927
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200120/70c2c58a/attachment.htm>


More information about the gerrit-log mailing list