Wireshark-dev: Re: [Wireshark-dev] [Wireshark-commits] rev 30846: /trunk/gtk/ /trunk/gtk/: capt

From: Gerald Combs <gerald@xxxxxxxxxxxxx>
Date: Sat, 07 Nov 2009 10:38:50 -0800
Guy Harris wrote:
On Nov 6, 2009, at 10:09 AM, gerald@xxxxxxxxxxxxx wrote:

http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=30846

User: gerald
Date: 2009/11/06 10:09 AM

Log:
Add some null pointer checks. This is a blind attempt to fix bug 4155.

Note that pcap_findalldevs() is not specified as guaranteeing that all interfaces have a non-null description field.

A quick look at the WinPcap 4.1.1 code doesn't seem to show any way for any interfaces to have a null description field on Windows, but perhaps I'm missing something. In any case, the checks for a null pointer probably still belong there, just in case, in the future, pcap_findalldevs() can return an interface with a null description field.

However, if the description field is null, no () will be printed. If it points to a null *string*, () will be printed - but you won't get a null-pointer dereference in that case.

In capture_interface_list we don't set the interface description if we get an empty string from dumpcap:

        if (strlen(if_parts[1]) > 0)
            if_info->description = g_strdup(if_parts[1]);

This is apparently how we ended up with null description pointers in capture_get_if_icon. Should we take out the if statement and set the description no matter what?