diff options
author | Peter Wu <peter@lekensteyn.nl> | 2014-07-29 00:04:00 +0200 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2014-07-29 01:53:32 +0000 |
commit | 0272b9c435db6b8665504d402ce1a23325f5b409 (patch) | |
tree | 37d6e8f1ad8906b16261f7995e9af218fcf217a7 /ui/gtk/hostlist_table.c | |
parent | 3db115a545587f3420b9509bd4dc6097417184d5 (diff) |
Fix heap-use-after-free via setlocale
setlocale returns a statically-allocated memory which can be modified by
subsequent calls of setlocale. This triggers a heap-use-after free in
ASAN when the setlocale function is called again with the previous
pointer.
This was found when trying to use the "Show All Streams" option via
the Telephony -> RTP menu.
While at it, add some modelines
Change-Id: Ide47e877ce828734fd8c5c1b064d9c505ba2b37a
Reviewed-on: https://code.wireshark.org/review/3234
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'ui/gtk/hostlist_table.c')
-rw-r--r-- | ui/gtk/hostlist_table.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ui/gtk/hostlist_table.c b/ui/gtk/hostlist_table.c index 0f1d034fae..3f5a65adfe 100644 --- a/ui/gtk/hostlist_table.c +++ b/ui/gtk/hostlist_table.c @@ -889,7 +889,7 @@ copy_as_csv_cb(GtkWindow *copy_bt, gpointer data _U_) if (!csv.talkers) return; - savelocale = setlocale(LC_NUMERIC, NULL); + savelocale = g_strdup(setlocale(LC_NUMERIC, NULL)); setlocale(LC_NUMERIC, "C"); csv.CSV_str = g_string_new(""); @@ -917,6 +917,7 @@ copy_as_csv_cb(GtkWindow *copy_bt, gpointer data _U_) cb = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); /* Get the default clipboard */ gtk_clipboard_set_text(cb, csv.CSV_str->str, -1); /* Copy the CSV data into the clipboard */ setlocale(LC_NUMERIC, savelocale); + g_free(savelocale); g_string_free(csv.CSV_str, TRUE); /* Free the memory */ } |