From 57d15713db46be0a48a29b4201aea976c20fb3e9 Mon Sep 17 00:00:00 2001 From: Joerg Mayer Date: Sun, 26 Mar 2017 19:11:02 +0200 Subject: Prevent crash/assert on access to "uninitialized" device.if_info.name. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While this is one possible way to fix it, it probably is not the "right" way to do it. I just don't know which one would be right. I regard several options to be cleaner: - Remove if_info from interface_t altogether and add the required fields to interface_t directly. - Never use device.if_info.name but always use device.name (same with friendly_name) - Initialize both fields the same (same with friendly_name) - Also not nice: device is optically a struct, not a pointer. So into the function, when we create a new struct (that's where the error "is made"), the same name continues to be used. Not improving my confidence into my solution: - I haven't bee able to figure out why the automated Windows builds don't crash/assert. Last but not least: The two qt/gtk functions should probably have their common core extracted into a common function. Change-Id: I1b36d1765d1a1ec975927cb5785a1540ba4952f5 Ping-Bug: 13448 Reviewed-on: https://code.wireshark.org/review/20721 Petri-Dish: Jörg Mayer Tested-by: Petri Dish Buildbot Reviewed-by: Jörg Mayer --- ui/qt/manage_interfaces_dialog.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'ui/qt/manage_interfaces_dialog.cpp') diff --git a/ui/qt/manage_interfaces_dialog.cpp b/ui/qt/manage_interfaces_dialog.cpp index e277f980fc..fc6eadd1ea 100644 --- a/ui/qt/manage_interfaces_dialog.cpp +++ b/ui/qt/manage_interfaces_dialog.cpp @@ -308,6 +308,7 @@ void ManageInterfacesDialog::updateRemoteInterfaceList(GList* rlist, remote_opti ips = 0; memset(&device, 0, sizeof(device)); device.name = g_strdup(if_info->name); + device.if_info.name = g_strdup("Don't crash on bug 13448"); /* Is this interface hidden and, if so, should we include it anyway? */ descr = capture_dev_user_descr_find(if_info->name); -- cgit v1.2.3