Re: [Wireshark-dev] [Wireshark-commits] rev 30846: /trunk/gtk/ /trunk/gtk/: capture_if_dlg.c

2009-11-07 Thread Guy Harris

On Nov 7, 2009, at 10:38 AM, Gerald Combs wrote:

> 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]);

Hmm.

Looking at capture_opts_list_interfaces(), which is what dumpcap uses  
to list the interfaces, if it's generating (more easily) machine- 
readable output, the output generated for a missing description  
(if_info->description is null) and the output generated for an empty  
description (if_info->description points to a null string) are the same.

> 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?

An empty description is no more useful than a null description, and,  
as indicated, pcap_findalldevs() doesn't guarantee that it will return  
a description for every adapter, so I wouldn't be inclined to do that;  
I'd be inclined to leave the if statement there.

(I'm thinking of redoing the way that dumpcap communicates with its  
callers for various reasons, including adding support for all the new  
stuff I added in libpcap 1.0, so, for example, we can have a "monitor  
mode" checkbox for wireless adapters if the relevant APIs work; I'll  
see if I can distinguish between "no description" and "empty  
description".)

I'm also curious how the description managed to be null - at least  
according to the bug report, Marvell *does* supply a description:

Connection-specific DNS Suffix  . :
Description . . . . . . . . . . . : Marvell Yukon 88E8056 PCI-E  
Gigabit Ethernet Controller
Physical Address. . . . . . . . . : 00-22-15-##-##-##
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::::.
IPv4 Address. . . . . . . . . . . : a.b.c.h(Preferred)
Subnet Mask . . . . . . . . . . . : w.x.y.z
Lease Obtained. . . . . . . . . . : 06 November 2009 18:38:00
Lease Expires . . . . . . . . . . : 09 November 2009 18:37:59
Default Gateway . . . . . . . . . : a.b.c.d
DHCP Server . . . . . . . . . . . : a.b.c.d
DNS Servers . . . . . . . . . . . : a.b.c.d
NetBIOS over Tcpip. . . . . . . . : Enabled

so there's presumably something odd going on in WinPcap here.
___
Sent via:Wireshark-dev mailing list 
Archives:http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
 mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe


Re: [Wireshark-dev] [Wireshark-commits] rev 30846: /trunk/gtk/ /trunk/gtk/: capture_if_dlg.c

2009-11-07 Thread Gerald Combs
Guy Harris wrote:
> On Nov 6, 2009, at 10:09 AM, ger...@wireshark.org 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?
___
Sent via:Wireshark-dev mailing list 
Archives:http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
 mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe


Re: [Wireshark-dev] [Wireshark-commits] rev 30846: /trunk/gtk/ /trunk/gtk/: capture_if_dlg.c

2009-11-06 Thread Guy Harris

On Nov 6, 2009, at 10:09 AM, ger...@wireshark.org 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.
___
Sent via:Wireshark-dev mailing list 
Archives:http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
 mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe