Wireshark-dev: Re: [Wireshark-dev] Warnings in airpcap_dlg.c

From: Gerald Combs <gerald@xxxxxxxxxxxxx>
Date: Wed, 13 May 2009 09:38:24 -0700
Joerg Mayer wrote:
> On Wed, May 13, 2009 at 12:37:58PM +0200, Stig Bj?rlykke wrote:
>> We have some warnings in airpcap_dlg.c where we check an unsigned
>> variable against a define with value zero.
>> Any ideas how we should fix this?  Removing the check is not what I wanted.
> 
> I'm not sure I understand what that code is intended to do, but it seems
> that the whole code was written with the (incorrect) assumption of
> SSID == "some sort of string" in mind. I don't think that it is possible
> to enter an SSID that contains a Zero-byte in the middle.

airpdcap.c uses uri_str_to_bytes() to build a GByteArray from the SSID
string. You should be able to use "%00" to represent a zero byte. This
also applies to the passphrase.

> The code in question does something even more interesting: It tests
> whether the length of the entered SSID is < 0. So removing that test
> doesn't introduce any problems.

We use a zero-length SSID to repesent a "wildcard" SSID. Otherwise the
length should be > 0 as far as I know. It should be safe to remove the test.