"Guy Harris" <g...@alum.mit.edu> wrote:

'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.)

What is the oldest version of WinPcap we should support in
libpcap? Here are the lines in question from an old version of <winpcap-SDK>\Packet9x\DLL\Packet32.c:

BOOLEAN PacketGetAdapterNames (PTSTR pStr,
   PULONG BufferSize)
{
   ULONG  Result,i;
   LONG  Status;
...
 PPACKET_OID_DATA  OidData;
...

OidData=GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT,256);
if (OidData == NULL) {
       return FALSE;
   }

(dated 8 July 2006 here).

Clearly it could return FALSE w/o touching '*BufferSize'. The
GlobalAllocPtr() is the 1st code in this function. Hence the precaution in fad-win32.c. Allthough no sane person should be using Win9x anymore,
there could be an old version of PacketNtx\Dll\Packet32.c with the same
lines.

--gv

_______________________________________________
tcpdump-workers mailing list
tcpdump-workers@lists.tcpdump.org
https://lists.sandelman.ca/mailman/listinfo/tcpdump-workers

Reply via email to