Ethereal-dev: Re: [Ethereal-dev] Edit->Preferences leads to core

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

From: Guy Harris <guy@xxxxxxxxxx>
Date: Mon, 27 Jan 2003 13:33:59 -0800
On Mon, Jan 27, 2003 at 03:09:42PM -0500, Jeff Morriss wrote:
> I've tried cleaning up as far as "make distclean" but I haven't been 
> able to find any problems in my environment.  The problem seems to 
> happen regardless of whether I have a "~/.ethereal/preferences" file.

It doesn't happen for me - instead, I get crap at the end of the option
menu of column formats.

> Any thoughts/ideas?

This is an unfortunate side-effect of a very useful feature of ANSI C -
compile-time string concatenation.  Whilst it allows string constants to
be constructed based on, for example, the values of various #defines, it
also means that the missing comma between "Circuit ID" and "Src PortIdx"
in

 gchar *dlist[] = { "Number", "Time (command line specified)",
                    "Relative time", "Absolute time",
                    "Absolute date and time", "Delta time",
                    "Source address", "Src addr (resolved)",
                    "Src addr (unresolved)", "Hardware src addr",
                    "Hw src addr (resolved)", "Hw src addr (unresolved)",
                    "Network src addr", "Net src addr (resolved)",
                    "Net src addr (unresolved)", "Destination address",
                    "Dest addr (resolved)", "Dest addr (unresolved)",
                    "Hardware dest addr", "Hw dest addr (resolved)",
                    "Hw dest addr (unresolved)", "Network dest addr",
                    "Net dest addr (resolved)", "Net dest addr (unresolved)",
                    "Source port", "Src port (resolved)",
                    "Src port (unresolved)", "Destination port",
                    "Dest port (resolved)", "Dest port (unresolved)",
                    "Protocol", "Information", "Packet length (bytes)" ,
                    "OXID", "RXID", "FW-1 monitor if/direction",
                    "Circuit ID"
                    "Src PortIdx", "Dst PortIdx", "VSAN",};

is not a syntax error, and

	1) causes the description of a "circuit ID" column to be

		Circuit IDSrc PortIdx

and

	2) causes "dlist[]" to have fewer than NUM_COL_FMTS elements, so
	   attempting to get the format string for COL_VSAN causes a
	   random pointer value to be returned (as "dlist[]" was an auto
	   array).

Whether that random pointer value causes a crash or not is itself
random.

I've checked in a fix.