diff options
-rw-r--r-- | epan/frame_data.h | 1 | ||||
-rw-r--r-- | file.c | 1 | ||||
-rw-r--r-- | gtk/packet_list_store.c | 12 |
3 files changed, 11 insertions, 3 deletions
diff --git a/epan/frame_data.h b/epan/frame_data.h index 90b44f919c..69b551b2e4 100644 --- a/epan/frame_data.h +++ b/epan/frame_data.h @@ -59,6 +59,7 @@ typedef struct _frame_data { nstime_t del_cap_ts; /* Delta timestamp to previous captured frame (yes, it can be negative) */ gint64 file_off; /* File offset */ gchar **col_text; /* The column text for some columns, see colum_utils */ + guint *col_text_len; /* The length of the column text strings in 'col_text' */ } frame_data; /* @@ -1266,6 +1266,7 @@ read_packet(capture_file *cf, dfilter_t *dfcode, fdata->flags.ref_time = 0; fdata->color_filter = NULL; fdata->col_text = NULL; + fdata->col_text_len = NULL; fdata->abs_ts.secs = phdr->ts.secs; fdata->abs_ts.nsecs = phdr->ts.nsecs; diff --git a/gtk/packet_list_store.c b/gtk/packet_list_store.c index 81c5d206e3..9ccacec645 100644 --- a/gtk/packet_list_store.c +++ b/gtk/packet_list_store.c @@ -660,12 +660,15 @@ packet_list_change_record(PacketList *packet_list, guint row, gint col, column_i g_assert(record->physical_pos == row); if (record->fdata->col_text && record->fdata->col_text[col] != NULL) - /* Column already contains a value. Bail out */ + /* TODO: Column already contains a value. Bail out */ return; - if (!record->fdata->col_text) + if (!record->fdata->col_text) { + record->fdata->col_text_len = se_alloc0(sizeof(record->fdata->col_text) * + (packet_list->n_columns-1)); record->fdata->col_text = se_alloc0(sizeof(record->fdata->col_text) * (packet_list->n_columns-1)); + } switch (cfile.cinfo.col_fmt[col]) { case COL_PROTOCOL: @@ -679,12 +682,15 @@ packet_list_change_record(PacketList *packet_list, guint row, gint col, column_i if (cinfo->col_data[col] != cinfo->col_buf[col]) { /* This is a constant string, so we don't have to copy it */ record->fdata->col_text[col] = (gchar *) cinfo->col_data[col]; + record->fdata->col_text_len[col] = (guint) strlen(record->fdata->col_text[col]); break; } /* !! FALL-THROUGH!! */ default: - record->fdata->col_text[col] = se_strdup(cinfo->col_data[col]); + record->fdata->col_text_len[col] = (guint) strlen(cinfo->col_data[col]); + record->fdata->col_text[col] = se_memdup(cinfo->col_data[col], + record->fdata->col_text_len[col] + 1); break; } } |