#37 segfaults on solaris

open
nobody
None
5
2007-04-05
2007-04-05
Chris Reece
No

A freshly compiled bandwidthd 2.0.1, compiled using GCC3 against libpcap as packaged by Blastwave (http://www.blastwave.org/) will segfault when called to list interfaces:

bash-3.00# ./bandwidthd -l
Segmentation Fault (core dumped)

Although it does otherwise work:

bash-3.00# ./bandwidthd
bash-3.00# ps -ef | grep bandwidthd
root 2953 1 0 15:11:39 pts/1 0:00 ./bandwidthd
root 2954 2953 0 15:11:39 pts/1 0:00 ./bandwidthd
root 2956 2953 0 15:11:39 pts/1 0:00 ./bandwidthd
root 2958 2469 0 15:11:43 pts/1 0:00 grep bandwidthd
root 2955 2953 0 15:11:39 pts/1 0:00 ./bandwidthd

These results appear to be independent of version or architecture (verified on Solaris 8/SPARC, Solaris 8/x86, Solaris 10/x86.)

It transpires that, in the Devices list returned by pcap_findalldevs, for at least some devices the pointer Devices->description is NULL. Indeed, the manual page for pcap_findalldevs says:

name
a pointer to a string giving a name for the device to
pass to pcap_open_live()

description
if not NULL, a pointer to a string giving a human-read-
able description of the device

The attached patch provides an obvious fix.

Cheers,

Chris.

Discussion

  • Chris Reece
    Chris Reece
    2007-04-05

     
    Attachments