summaryrefslogtreecommitdiff
path: root/epan/uat-int.h
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2015-02-14 15:36:09 +0100
committerMichael Mann <mmann78@netscape.net>2015-02-15 23:52:24 +0000
commit4f3646fe62244f7aba3f309c509c3414f1028650 (patch)
tree712dcb64e50d76a301b7149f148ee207a8d11a1f /epan/uat-int.h
parentf5902a677e24ff96869d3c335f4fb8aaa6d0e543 (diff)
downloadwireshark-4f3646fe62244f7aba3f309c509c3414f1028650.tar.gz
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 'epan/uat-int.h')
-rw-r--r--epan/uat-int.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/epan/uat-int.h b/epan/uat-int.h
index 88c52f4b33..c1b488ba99 100644
--- a/epan/uat-int.h
+++ b/epan/uat-int.h
@@ -85,6 +85,9 @@ WS_DLL_PUBLIC
void* uat_add_record(uat_t*, const void* orig_rec_ptr, gboolean valid_rec);
WS_DLL_PUBLIC
+void uat_update_record(uat_t *uat, const void *data, gboolean valid_rec);
+
+WS_DLL_PUBLIC
void uat_swap(uat_t*, guint idx_a, guint idx_b);
WS_DLL_PUBLIC