https://bugzilla.novell.com/show_bug.cgi?id=705562
https://bugzilla.novell.com/show_bug.cgi?id=705562#c5
Jon Nelson changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |NEW
InfoProvider|jnelson-suse@jamponi.net |
--- Comment #5 from Jon Nelson 2011-08-12 19:55:30 UTC ---
I rebuilt lsusb on that machine (using the version from tumbleweed):
#0 do_otg (dev=0x6e9720) at lsusb.c:3440
3440 desc = find_otg(config->extra, config->extra_length);
(gdb) bt
#0 do_otg (dev=0x6e9720) at lsusb.c:3440
#1 dumpdev (dev=0x6e9720) at lsusb.c:3804
#2 0x00000000004097dc in list_devices (ctx=<value optimized out>, busnum=-1,
devnum=-1, vendorid=-1, productid=-1) at lsusb.c:3889
#3 0x0000000000409c46 in main (argc=2, argv=0x7fff9e2c8208) at lsusb.c:4056
(gdb)
I believe this:
libusb_get_config_descriptor(dev, 0, &config);
should set config (via *config = NULL) to NULL.
It's uninitialized and that's the problem.
A workaround is for the caller (lsusb.c) to initialize config to NULL *before*
calling libusb_get_config_descriptor *and*
a) the rest of the library needs to handle a NULL config
b) if config is NULL, there is no point in continuing
I did not do a comprehensive review of the rest of the code to see what other
dragons there be.
--- lsusb.c.orig 2011-01-12 17:09:41.000000000 -0600
+++ lsusb.c 2011-08-12 14:54:13.282422990 -0500
@@ -3798,16 +3798,20 @@
if (desc.bcdUSB == 0x0250)
wireless = do_wireless(udev);
if (desc.bNumConfigurations) {
- struct libusb_config_descriptor *config;
+ struct libusb_config_descriptor *config = NULL;
libusb_get_config_descriptor(dev, 0, &config);
- otg = do_otg(config) || otg;
- libusb_free_config_descriptor(config);
+ if (config == NULL) {
+ fprintf(stderr, "Unable to get description.\n");
+ } else {
+ otg = do_otg(config) || otg;
+ libusb_free_config_descriptor(config);
- for (i = 0; i < desc.bNumConfigurations; ++i) {
- libusb_get_config_descriptor(dev, i, &config);
- dump_config(udev, config);
- libusb_free_config_descriptor(config);
+ for (i = 0; i < desc.bNumConfigurations; ++i) {
+ libusb_get_config_descriptor(dev, i, &config);
+ dump_config(udev, config);
+ libusb_free_config_descriptor(config);
+ }
}
}
if (!udev)
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.