From f9a5bf58057b0b65a8a062c2b13b6d206bbd9fd6 Mon Sep 17 00:00:00 2001 From: John Thacker Date: Wed, 9 Nov 2022 20:37:39 -0500 Subject: [PATCH] WASSP: Don't add a NULL to a column The result of try_val_to_str can be NULL, don't add a null address to a column. Ensure that an appropriate unknown string is added instead. Fix #18613 --- epan/dissectors/packet-wassp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/epan/dissectors/packet-wassp.c b/epan/dissectors/packet-wassp.c index 8e92f985e8..6f456b60f9 100644 --- a/epan/dissectors/packet-wassp.c +++ b/epan/dissectors/packet-wassp.c @@ -5887,7 +5887,7 @@ static int dissect_wassp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) fragment_head *wassp_frag_msg = NULL; gboolean save_fragmented; tvbuff_t *next_tvb = NULL, *combined_tvb = NULL; - char *label; + const char *label; conversation_t *conv = NULL; guint32 reassembly_id; @@ -5912,7 +5912,7 @@ static int dissect_wassp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) if ( ru_msg_type == WASSP_Data ) // wassp mu header { - label = (char*)try_val_to_str(tvb_get_guint8(tvb, WASSP_HDR_LEN + WASSP_MU_HDR_TYPE), wassp_mu_header_types); + label = val_to_str_const(tvb_get_guint8(tvb, WASSP_HDR_LEN + WASSP_MU_HDR_TYPE), wassp_mu_header_types, "Unknown WASSP MU Message Type"); col_add_str(pinfo->cinfo, COL_INFO, label); } else if (ru_msg_type == WASSP_RU_Discov) /* ap discover header*/ @@ -5922,10 +5922,10 @@ static int dissect_wassp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) else col_add_str(pinfo->cinfo, COL_INFO, "RU Discover Response"); } - else if (ru_msg_type != WASSP_Data) - col_add_str(pinfo->cinfo, COL_INFO, (char*)try_val_to_str(tvb_get_guint8(tvb, WASSP_HDR_TYPE), wassp_header_types)); else - col_add_str(pinfo->cinfo, COL_INFO, "Unknown WASSP Message Type"); + { + col_add_str(pinfo->cinfo, COL_INFO, val_to_str_const(tvb_get_guint8(tvb, WASSP_HDR_TYPE), wassp_header_types, "Unknown WASSP Message Type")); + } save_fragmented = pinfo->fragmented;