diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2009-10-12 08:04:30 +0000 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2009-10-12 08:04:30 +0000 |
commit | 96b31924f058b4b744ce0a23f8dcc063518b160c (patch) | |
tree | 5914013ffe85e674199d3010250b42e2b985f2d0 /epan/column.c | |
parent | 23c0b494a722771a04f9ca9ed59d95c335e58a56 (diff) | |
download | wireshark-96b31924f058b4b744ce0a23f8dcc063518b160c.tar.gz |
Added check for valid column in get_column_title() and
get_column_custom_field().
svn path=/trunk/; revision=30531
Diffstat (limited to 'epan/column.c')
-rw-r--r-- | epan/column.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/epan/column.c b/epan/column.c index 1bca3a40ae..8f132a309e 100644 --- a/epan/column.c +++ b/epan/column.c @@ -616,20 +616,22 @@ get_column_char_width(gint format) } gint -get_column_format(gint col) { +get_column_format(gint col) +{ GList *clp = g_list_nth(prefs.col_list, col); fmt_data *cfmt; if (!clp) /* Invalid column requested */ return -1; - + cfmt = (fmt_data *) clp->data; return(get_column_format_from_str(cfmt->fmt)); } gint -get_column_format_from_str(gchar *str) { +get_column_format_from_str(gchar *str) +{ gint i; for (i = 0; i < NUM_COL_FMTS; i++) { @@ -640,20 +642,28 @@ get_column_format_from_str(gchar *str) { } gchar * -get_column_title(gint col) { +get_column_title(gint col) +{ GList *clp = g_list_nth(prefs.col_list, col); fmt_data *cfmt; + if (!clp) /* Invalid column requested */ + return -1; + cfmt = (fmt_data *) clp->data; return(cfmt->title); } const gchar * -get_column_custom_field(gint col) { +get_column_custom_field(gint col) +{ GList *clp = g_list_nth(prefs.col_list, col); fmt_data *cfmt; + if (!clp) /* Invalid column requested */ + return -1; + cfmt = (fmt_data *) clp->data; return(cfmt->custom_field); |