From 910bc034abd8e5209dc6ccd8cacdafdc59b1c9dc Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Tue, 26 Jun 2018 16:12:37 -0700 Subject: TRANSUM: fix crash when switching profiles "output_rrpd" is NULL when the TRANSUM dissector is disabled (which is the default behavior). When switching to a profile where the dissector is enabled, redissection happens, but without invoking the init routine. This leads to a crash when dissect_transum tries to query "output_rrpd". Fix this by creating the map unconditionally. Use wmem_map_new_autoreset since its contents should be erased for new capture files. Bug: 13697 Change-Id: Iea897da8faf8042dffdc74327d9d1221e5fb155f Fixes: v2.3.0rc0-1887-g78d56e5dd7 ("Cleanup transum post-dissector.") Reviewed-on: https://code.wireshark.org/review/28474 Petri-Dish: Peter Wu Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- plugins/epan/transum/packet-transum.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins/epan') diff --git a/plugins/epan/transum/packet-transum.c b/plugins/epan/transum/packet-transum.c index e2dd054d71..0fdb8fb4cc 100644 --- a/plugins/epan/transum/packet-transum.c +++ b/plugins/epan/transum/packet-transum.c @@ -801,8 +801,6 @@ static void init_globals(void) wmem_map_insert(preferences.tcp_svc_ports, GUINT_TO_POINTER(445), GUINT_TO_POINTER(RTE_CALC_SMB2)); wmem_map_insert(preferences.udp_svc_ports, GUINT_TO_POINTER(53), GUINT_TO_POINTER(RTE_CALC_DNS)); - - output_rrpd = wmem_map_new(wmem_file_scope(), g_direct_hash, g_direct_equal); } /* Undo capture file-specific initializations. */ @@ -1335,6 +1333,8 @@ proto_register_transum(void) register_cleanup_routine(cleanup_globals); register_postdissector(transum_handle); + + output_rrpd = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), g_direct_hash, g_direct_equal); } void proto_reg_handoff_transum(void) -- cgit v1.2.3