tcpdump mailing list archives
Re: [Patch] fad-win32.c
From: Guy Harris <guy () alum mit edu>
Date: Thu, 4 Apr 2013 10:50:47 -0700
On Apr 4, 2013, at 1:20 AM, Gisle Vanem <gvanem () broadpark no> wrote:
This is a similar patch to the change of pcap-dos.c: https://github.com/mcr/libpcap/commit/73b5f0387199fbaa75130837b931faf770471640 I.e. the '_interfaces' suffix got lost in some other change to the puplic API. (I don't know when). Since 'pcap_findalldevs()' is now a more generic version in pcap.c, the platform-specific function is called 'pcap_findalldevs_interfaces()' in fad-win32.c:
Checked in to the trunk and 1.4 branches.
'NameLength = 0' is just in case 'PacketGetAdapterNames()' fails w/o setting '*NameLength == 0'. It really could do that; ref. Packet32.c in WinPcap.
Really? I don't see that. (The first call should *always* "fail", in the sense of returning FALSE; if the cause of the "failure" is that the buffer pointer argument is NULL, not that it couldn't get the interface list, it should set NameLength to the size of the buffer it needs.) However, PacketGetAdapterNames() *will* check whether the buffer size argument is big enough before checking whether the buffer pointer argument is null; if either one is true, it'll "fail" with ERROR_INSUFFICIENT_BUFFER and set NameLength to the required buffer size, but, as long as it tests the buffer size before the buffer pointer, we should, for cleanliness' sake, initialize the buffer size to 0. _______________________________________________ tcpdump-workers mailing list tcpdump-workers () lists tcpdump org https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers
Current thread:
- [Patch] fad-win32.c Gisle Vanem (Apr 04)
- Re: [Patch] fad-win32.c Guy Harris (Apr 04)
- Re: [Patch] fad-win32.c Gisle Vanem (Apr 04)
- Re: [Patch] fad-win32.c Guy Harris (Apr 04)