From 7e76e5f2c865fa868b551fb974f71dade1972383 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Mon, 5 Feb 2018 14:28:10 -0800 Subject: Make sure we pass valid addresses to find_conversation. Pass empty (AT_NONE) addresses to find_conversation and conversation_create_endpoint instead of NULL, similar to the LBTxx and other dissectors. Bug: 14394 Change-Id: Ia4573b276551a9c3d2da155faf786e8d15229100 Reviewed-on: https://code.wireshark.org/review/25620 Petri-Dish: Gerald Combs Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs --- epan/conversation.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/epan/conversation.c b/epan/conversation.c index aac4adc747..c653166b32 100644 --- a/epan/conversation.c +++ b/epan/conversation.c @@ -77,6 +77,12 @@ static wmem_map_t *conversation_hashtable_no_addr2_or_port2 = NULL; static guint32 new_index; +/* + * Placeholder for address-less conversations. + */ +static address null_address_ = ADDRESS_INIT_NONE; + + /* * Creates a new conversation with known endpoints based on a conversation * created with the CONVERSATION_TEMPLATE option while keeping the @@ -626,9 +632,9 @@ conversation_new(const guint32 setup_frame, const address *addr1, const address conversation_t *conversation=NULL; conversation_key_t new_key; - DPRINT(("creating conversation for frame #%d: %s:%d -> %s:%d (ptype=%d)", + DPRINT(("creating conversation for frame #%d: %s:%d -> %s:%d (etype=%d)", setup_frame, address_to_str(wmem_packet_scope(), addr1), port1, - address_to_str(wmem_packet_scope(), addr2), port2, ptype)); + address_to_str(wmem_packet_scope(), addr2), port2, etype)); if (options & NO_ADDR2) { if (options & (NO_PORT2|NO_PORT2_FORCE)) { @@ -1190,7 +1196,7 @@ find_conversation(const guint32 frame_num, const address *addr_a, const address conversation_t *find_conversation_by_id(const guint32 frame, const endpoint_type etype, const guint32 id, const guint options) { /* Force the lack of a address or port B */ - return find_conversation(frame, NULL, NULL, etype, id, 0, options|NO_ADDR_B|NO_PORT_B); + return find_conversation(frame, &null_address_, &null_address_, etype, id, 0, options|NO_ADDR_B|NO_PORT_B); } void @@ -1393,7 +1399,7 @@ void conversation_create_endpoint_by_id(struct _packet_info *pinfo, endpoint_type etype, guint32 id, const guint options) { /* Force the lack of a address or port B */ - conversation_create_endpoint(pinfo, NULL, NULL, etype, id, 0, options|NO_ADDR_B|NO_PORT_B); + conversation_create_endpoint(pinfo, &null_address_, &null_address_, etype, id, 0, options|NO_ADDR_B|NO_PORT_B); } guint32 conversation_get_endpoint_by_id(struct _packet_info *pinfo, endpoint_type etype, const guint options) -- cgit v1.2.3