Wireshark-dev: Re: [Wireshark-dev] Patch for bug 1377 that produces a modal dialog with garbage
From: "Peter Johansson" <peterjohansson73@xxxxxxxxx>
Date: Mon, 2 Apr 2007 16:28:46 +0200
This is a repost! Please consider this patch for Bug 1377.
Regards, Peter
2007/3/30, Peter Johansson <peterjohansson73@xxxxxxxxx>:
2007/3/30, Jeff Morriss < jeff.morriss@xxxxxxxxxxx>:After having read the description for bug 1377 I agree. This patch fixes that problem.
Peter Johansson wrote:
> I compiled Wireshark with HAVE_AIRPDCAP by mistake (since I do not
> have AirPcap). This leads to a runtime problem however. When
> choosing "options" from the "Capture interfaces" dialog, I receive a
> modal dialogue with an OK button with a textual description that is
> only garbage (uninitialized memory).
>
> The provided patch adds a new error - AIRPCAP_NOT_LOADED (2) code to
> the airpcap loader that also adds the text "AirPcap was expected to
> be loaded but is not" to the modal dialogue instead of the
> uninitialized string.
Hmm, I think you found the problem of bug 1377:
http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1377
Having a quick look, though, I am a bit confused because it doesn't
appear anybody ever allocates any space for 'err_str' before calling
though maybe I'm missing it. Anyway I don't really have time to dig
further for the moment.
Another thing that needs a look is it appears that it's normal that
AirPcap is compiled in (I didn't change my setup and my Windoze builds
say "with Airpcap") though in that case I'm not sure it should be
complaining at all if it doesn't find an AirPcap device or whatever.
err_str should not be allocated prior to calling get_airpcap_interface_list(&err, &err_str). err_str gets assigned a pointer to allocated memory (g_strdup) in the called function that gets freed when returning from the function.
Thank you for having me review my changes once more. It turns out that my original change will make the code call g_free for the newly added statically allocated error description which would be a new error.
I have attached a new set of files to be supplied as a solution for bug 1377. This time my changes allocate the error description using g_strdup just like the rest of the code, making it possible to call g_free upon return from the get_airpcap_interface_list(...) function.
I was also wondering how to handle this case, should it not produce a dialogue at all? I am unsure. If a dialogue is not displayed, the user will never understand why the AirPcap devices do not show up if AirPcap is not loaded but Wireshark is compiled with support for it. On the other hand, I guess most users do not have AirPcap, which means that it would be annoying to get the dialogue every time when entering the options dialogue.
Therefor I have changed the code in airpcap_loader.c even further to produce the modal dialogue stating that AirPcap is not loaded only once per Wireshark session. Hence it will not get displayed more than once unless the user restarts Wireshark. Unfortunately I had to make changes to more files than I would have wanted to be able to do this.
Is that good enough?
Regards, Peter
- Prev by Date: [Wireshark-dev] Questions about IEEE 802.11 dissector
- Next by Date: Re: [Wireshark-dev] Update official Windows build?
- Previous by thread: Re: [Wireshark-dev] Questions about IEEE 802.11 dissector
- Next by thread: Re: [Wireshark-dev] Discrepancies between summary view and detailsview - rpc dissector
- Index(es):