Ethereal-dev: Re: [Ethereal-dev] capture_if_dlg.c has weird #if directive + proto_tree_add_ite

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxx>
Date: Sun, 29 Aug 2004 10:12:11 -0700
metatech wrote:

[For another reason I had to define explicitly WIN32 in pcap.h so that it compiles,

"It" meaning WinPcap, or "it" meaning Ethereal?


"It" meaning Ethereal.

Why does it not compile unless WIN32 is defined in pcap.h?

I have another remark:
I noticed that if I call proto_tree_add_item() with a length parameter = 0, Ethereal crashes on win32.
Wouldn't it be more factorised/safer to check for "length > 0" in proto.c ?

It'd be safer not to call it with a length of 0. :-)

"proto_tree_add_item()" means "grab data from the packet and use it as the value for this item"; a length of 0 means there's no data to be grabbed.

If it were to do anything with a length of 0, at least for most items, if not all items, what it should do is not put an entry into the protocol tree in the first place.