Menu

#167 libusb_init()'s return value not checked leading to segfault

closed-fixed
nobody
None
5
2013-11-20
2012-08-06
Anonymous
No

Running tcpdump on a host without a mounted usbfs will result in a segfault, unless the interface is specified.

The return value of libusb_init() [1] should be checked to make sure it's appropriate to continue with the other calls to libusb.

There is also a downstream report [2] of this issue on Arch Linux's bug tracker which includes a backtrace [3].

[1] https://github.com/mcr/libpcap/blob/master/pcap-canusb-linux.c#L96
[2] https://bugs.archlinux.org/task/31014
[3] http://pastie.org/4392531

Discussion

  • Guy Harris

    Guy Harris - 2012-08-06

    Change I checked in

     
  • Guy Harris

    Guy Harris - 2012-08-06

    OK, I've checked in a change to check whether libusb_init() returned a non-zero value and, if it did, just give up without looking for USB CAN devices.

    I've attached a patch for the change in question; check it out to see whether it fixes the problem. I'll look at various downstream bugs and point them at this.

     
  • Guy Harris

    Guy Harris - 2012-08-06
    • status: open --> closed-fixed
     
  • Denis Ovsienko

    Denis Ovsienko - 2013-11-20

    Administrators of the "libpcap" SourceForge project have superseded this tracker item (formerly artifact 3554749, now bug 167) with issue 170 of the "libpcap" GitHub project.