From 1ea6b4fe2e4b6e068694301c4ffc731e2309c797 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sun, 7 Aug 2016 12:58:59 +0200 Subject: [PATCH] prefs: fix crash with -o column.foo:x The gui.column module is somehow special, it has no name since it is part of the gui module. This causes a crash when trying to invoke `strcmp(module->name /* NULL */, "mgcp")`. Always look up prefs inside gui_column_module when the given prefs module is "column" instead of matching two specific names. Change-Id: I47e354d11b6fd01818b0627a249b506a8f9510cc Reviewed-on: https://code.wireshark.org/review/16937 Petri-Dish: Peter Wu Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu --- epan/prefs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/epan/prefs.c b/epan/prefs.c index 69b649e36e..b7a46e3d71 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -4172,10 +4172,10 @@ set_pref(gchar *pref_name, const gchar *value, void *private_data _U_, /* "gui" prefix was added to column preferences for better organization * within the preferences file */ - if ((strcmp(pref_name, PRS_COL_HIDDEN) == 0) || - (strcmp(pref_name, PRS_COL_FMT) == 0)) { + if (module == gui_column_module) { /* While this has a subtree, there is no apply callback, so no - * need to use prefs_find_preference_with_submodule. */ + * need to use prefs_find_preference_with_submodule to update + * containing_module. It would not be useful. */ pref = prefs_find_preference(module, pref_name); } else if (strcmp(module->name, "mgcp") == 0) {