Ethereal-dev: Re: [Ethereal-dev] Unusual column.c problem

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

From: Gilbert Ramirez <gram@xxxxxxxxxx>
Date: Fri, 1 Dec 2000 10:41:47 -0500
On Fri, Dec 01, 2000 at 08:05:20AM -0600, Jeff Foster wrote:
> 
> Trying to convert ethereal to curses I have stumbled on this
> problem, in get_column_format if the clp value is null a 
> segmentation violation is generated.  I admit this is an 
> unusual situation.  However I think a simple sanity check here
> could avoid the segmentation violation and either terminate
> the program with an error or generate an assert message. 
> 
> gint
> get_column_format(gint col) {
>   GList    *clp = g_list_nth(prefs.col_list, col);
>   fmt_data *cfmt;
> 
> /*$$$ need to test for clp = 0 here and handle it or quit */
>   cfmt = (fmt_data *) clp->data;
> 
>   return(get_column_format_from_str(cfmt->fmt));
> }

Some g_assert() calls here and in other column-related functions
would not be a bad idea.

--gilbert