diff options
author | Peter Wu <peter@lekensteyn.nl> | 2015-02-14 15:36:09 +0100 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2015-02-15 23:52:24 +0000 |
commit | 4f3646fe62244f7aba3f309c509c3414f1028650 (patch) | |
tree | 712dcb64e50d76a301b7149f148ee207a8d11a1f /ui/gtk | |
parent | f5902a677e24ff96869d3c335f4fb8aaa6d0e543 (diff) |
Fix handling of invalid UAT items
If the UAT file failed a field check, then the user_data pointer may be
empty. As a result uat_save() triggers an invalid write.
(Discovered while working with a dfilter_macros file having duplicate
names for bug 10957, caught by ASAN.)
The second issue fixed in this patch is that the validity of an item is
only calculated when a new record is added. So even if the user edits
the UAT and makes the entry valid, it would not be saved. This is solved
by adding a new uat_update_record() function which got wires up into GTK
and Qt.
Some open-coded g_array_index and UAT[_USER]_INDEX_PTR are also
converted.
Even after this patch, Qt has some issues with UAT handling. In
particular, it saves new, but empty/invalid, items. It also it does not
check individual fields when saving all fields (unlike Gtk). This patch
focused on getting Gtk fixed first so ignores those existing issues.
Change-Id: Ia35cfe9d2b793c65144ae7e29a1ed706b6668d99
Reviewed-on: https://code.wireshark.org/review/7120
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'ui/gtk')
-rw-r--r-- | ui/gtk/uat_gui.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/ui/gtk/uat_gui.c b/ui/gtk/uat_gui.c index 422e25dfa7..1b30680b76 100644 --- a/ui/gtk/uat_gui.c +++ b/ui/gtk/uat_gui.c @@ -394,6 +394,8 @@ static gboolean uat_dlg_cb(GtkWidget *win _U_, gpointer user_data) { } g_free(rec_tmp); + } else { + uat_update_record(dd->uat, dd->rec, TRUE); } dd->uat->changed = TRUE; |