summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-01-14 16:55:40 -0800
committerGerald Combs <gerald@wireshark.org>2015-01-15 00:59:02 +0000
commitb63a942c4b1466d1638b991653c9b3e1e8a0daad (patch)
tree95b03bfce03fee31ea2dbf91c117b9fcb65f16b3
parentd443db06ccbc25cb998ea87c184497f6b9529848 (diff)
downloadwireshark-b63a942c4b1466d1638b991653c9b3e1e8a0daad.tar.gz
Fix a crash in the GTK+ RTP Streams dialog.
Make sure we copy guint, gdouble, and gchar * data to variables of the correct type. Fixes a crash when trying to copy CSV data (we were trying to stuff a gdouble into a char *). Change-Id: I3cbcc48216a078f85f13860d14707f309b9820d7 Reviewed-on: https://code.wireshark.org/review/6541 Reviewed-by: Gerald Combs <gerald@wireshark.org>
-rw-r--r--ui/gtk/rtp_stream_dlg.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/ui/gtk/rtp_stream_dlg.c b/ui/gtk/rtp_stream_dlg.c
index bf1d9033f0..160268b3ac 100644
--- a/ui/gtk/rtp_stream_dlg.c
+++ b/ui/gtk/rtp_stream_dlg.c
@@ -460,6 +460,7 @@ rtpstream_on_copy_as_csv(GtkWindow *win _U_, gpointer data _U_)
guint i,j;
gchar *table_entry;
guint table_entry_uint;
+ gdouble table_entry_double;
GString *CSV_str;
GtkClipboard *cb;
@@ -478,13 +479,19 @@ rtpstream_on_copy_as_csv(GtkWindow *win _U_, gpointer data _U_)
if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(list_store), &iter)) {
for (i=0; i<streams_nb; i++) {
for (j=0; j<NUM_COLS-1; j++) {
- if (j == RTP_COL_SRC_PORT || j == RTP_COL_DST_PORT || j == RTP_COL_PACKETS) {
+ //if (j == RTP_COL_SRC_PORT || j == RTP_COL_DST_PORT || j == RTP_COL_PACKETS) {
+ if (gtk_tree_model_get_column_type(GTK_TREE_MODEL(list_store), j) == G_TYPE_UINT) {
gtk_tree_model_get(GTK_TREE_MODEL(list_store), &iter, j, &table_entry_uint, -1);
g_string_append_printf(CSV_str, "\"%u\"", table_entry_uint);
- } else {
+ } else if (gtk_tree_model_get_column_type(GTK_TREE_MODEL(list_store), j) == G_TYPE_DOUBLE) {
+ gtk_tree_model_get(GTK_TREE_MODEL(list_store), &iter, j, &table_entry_double, -1);
+ g_string_append_printf(CSV_str, "\"%f\"", table_entry_uint);
+ } else if (gtk_tree_model_get_column_type(GTK_TREE_MODEL(list_store), j) == G_TYPE_STRING) {
gtk_tree_model_get(GTK_TREE_MODEL(list_store), &iter, j, &table_entry, -1);
g_string_append_printf(CSV_str, "\"%s\"", table_entry);
g_free(table_entry);
+ } else {
+ g_assert_not_reached();
}
if (j<NUM_COLS-2) g_string_append(CSV_str,",");
}