aboutsummaryrefslogtreecommitdiffstats
path: root/epan/column-utils.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2011-04-09 04:33:26 +0000
committerGuy Harris <guy@alum.mit.edu>2011-04-09 04:33:26 +0000
commitc8d2cd3cb51a4144b38bfaf82482bd30d7df1064 (patch)
tree35021789d235618531aa84e14807ed9fbdf789ec /epan/column-utils.c
parenta5ddd187ca1ac67edfceba0702f5f017f6447d4b (diff)
In packet_list_dissect_and_cache_record(), set the columns to
*something* if we get an error reading the packet from the capture file, rather than leaving them as null (which will cause a crash). svn path=/trunk/; revision=36527
Diffstat (limited to 'epan/column-utils.c')
-rw-r--r--epan/column-utils.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/epan/column-utils.c b/epan/column-utils.c
index 83e60718e9..17ee2ad18e 100644
--- a/epan/column-utils.c
+++ b/epan/column-utils.c
@@ -1652,6 +1652,57 @@ col_fill_in(packet_info *pinfo, const gboolean fill_col_exprs, const gboolean fi
}
}
+/*
+ * Fill in columns if we got an error reading the packet.
+ * We set most columns to "???", and set the Info column to an error
+ * message.
+ */
+void
+col_fill_in_error(column_info *cinfo, frame_data *fdata, const gboolean fill_col_exprs, const gboolean fill_fd_colums)
+{
+ int i;
+
+ if (!cinfo)
+ return;
+
+ for (i = 0; i < cinfo->num_cols; i++) {
+ switch (cinfo->col_fmt[i]) {
+
+ case COL_NUMBER:
+ case COL_CLS_TIME:
+ case COL_ABS_TIME:
+ case COL_ABS_DATE_TIME:
+ case COL_REL_TIME:
+ case COL_DELTA_TIME:
+ case COL_DELTA_TIME_DIS:
+ case COL_PACKET_LENGTH:
+ case COL_CUMULATIVE_BYTES:
+ if (fill_fd_colums)
+ col_fill_in_frame_data(fdata, cinfo, i, fill_col_exprs);
+ break;
+
+ case COL_INFO:
+ /* XXX - say more than this */
+ cinfo->col_data[i] = "Read error";
+ break;
+
+ case NUM_COL_FMTS: /* keep compiler happy - shouldn't get here */
+ g_assert_not_reached();
+ break;
+ default:
+ if (cinfo->col_fmt[i] >= NUM_COL_FMTS) {
+ g_assert_not_reached();
+ }
+ /*
+ * No dissection was done, and these columns are set as the
+ * result of the dissection, so....
+ */
+ cinfo->col_data[i] = "???";
+ break;
+ }
+ }
+}
+
#if 0
XXX this needs more rework?
/* --------------------------- */