summaryrefslogtreecommitdiff
path: root/epan/packet.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2016-07-12 11:25:49 -0700
committerGuy Harris <guy@alum.mit.edu>2016-07-12 18:26:24 +0000
commitfea50cc4d6cec282271f44de558956ed7b3d2a39 (patch)
tree81daf7b37394e4c673a79168397c410aa660d563 /epan/packet.c
parent719c018f27fcac398c8c5012a875d3ccd466e7ae (diff)
downloadwireshark-fea50cc4d6cec282271f44de558956ed7b3d2a39.tar.gz
Handle dissectors that don't have names.
Dissector handles created with create_dissector_handle() don't have a name; report them as "(anonymous)" (there's no guarantee that the printf family of routines don't crash when a null pointer is provided to %s - the printf routines in at least some versions of Solaris *do* crash in that case). Change-Id: I561ff855a46eeb442299011d567f20751c5c6869 Reviewed-on: https://code.wireshark.org/review/16399 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/packet.c')
-rw-r--r--epan/packet.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/epan/packet.c b/epan/packet.c
index 3573a982df..6c74fd9287 100644
--- a/epan/packet.c
+++ b/epan/packet.c
@@ -1794,9 +1794,16 @@ dissector_add_for_decode_as(const char *name, dissector_handle_t handle)
dup_handle = (dissector_handle_t)entry->data;
if (dup_handle->protocol == handle->protocol)
{
+ const char *dissector_name, *dup_dissector_name;
+
+ dissector_name = dissector_handle_get_dissector_name(handle);
+ if (dissector_name == NULL)
+ dissector_name = "(anonymous)";
+ dup_dissector_name = dissector_handle_get_dissector_name(dup_handle);
+ if (dup_dissector_name == NULL)
+ dup_dissector_name = "(anonymous)";
fprintf(stderr, "Duplicate dissectors %s and %s for protocol %s in dissector table %s\n",
- dissector_handle_get_dissector_name(handle),
- dissector_handle_get_dissector_name(dup_handle),
+ dissector_name, dup_dissector_name,
proto_get_protocol_short_name(handle->protocol),
name);
if (getenv("WIRESHARK_ABORT_ON_DISSECTOR_BUG") != NULL)