Package: usbutils
Version: 1:007-2
Severity: normal
Tags: patch



Hi,

I got the following error running 'lsusb -t':

# lsusb -t
Segmentation fault

It seems to happen because my directory /sys/bus/usb/devices/ is empty.

I've checked the code and found that as the directory is empty, usbbuslist isn't populated (still NULL). In the function sort_busses, usbbuslist is used as it
isn't NULL, but it's the case here, so it ends with a segmentation fault.

To prevent this error I've added a quick check in the code about usbbuslist at
the beginning of the function sort_busses. Patch in attachment.

Hope it helps.

--- a/lsusb-t.c	2013-06-06 19:13:12.000000000 -0400
+++ b/lsusb-t.c	2014-03-27 07:39:56.075336155 -0400
@@ -605,6 +605,7 @@
 	/* need to reverse sort bus numbers */
 	struct usbbusnode *t, *p, **pp;
 	int swapped;
+	if (!usbbuslist) return;
 	do {
 		p = usbbuslist;
 		pp = &usbbuslist;

Reply via email to