diff options
author | Dario Lombardo <lomato@gmail.com> | 2020-01-10 15:42:58 +0100 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2020-01-21 04:44:31 +0000 |
commit | 084a887a30b78a3f4f42aa35a15049c251adfcfa (patch) | |
tree | a28ee4be438301451dbb959ad9817ea563f5a878 /epan | |
parent | 567991b8fb7f1524d4860273ec0c01fd928bf353 (diff) |
Fix compilation with gcc-9.
gcc-9 spotted some NULL pointer usages.
Bug: 16319
Change-Id: I3e4ac57705f1852c43299f5e924fc642a2c56a3a
Reviewed-on: https://code.wireshark.org/review/35733
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-gsm_a_bssmap.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-tnef.c | 15 |
2 files changed, 9 insertions, 10 deletions
diff --git a/epan/dissectors/packet-gsm_a_bssmap.c b/epan/dissectors/packet-gsm_a_bssmap.c index c9aadd49d7..7547e949f5 100644 --- a/epan/dissectors/packet-gsm_a_bssmap.c +++ b/epan/dissectors/packet-gsm_a_bssmap.c @@ -1223,7 +1223,6 @@ bssmap_dissect_cause(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint3 { guint8 oct; guint32 curr_offset; - const gchar *str = NULL; curr_offset = offset; @@ -1263,7 +1262,8 @@ bssmap_dissect_cause(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint3 curr_offset++; if (add_string) - g_snprintf(add_string, string_len, " - (%u) %s", oct & 0x7f, str); + g_snprintf(add_string, string_len, " - (%u) %s", oct & 0x7f, + rval_to_str_const(oct & 0x7f, gsm_a_bssap_cause_rvals, "Unknown")); } EXTRANEOUS_DATA_CHECK(len, curr_offset - offset, pinfo, &ei_gsm_a_bssmap_extraneous_data); diff --git a/epan/dissectors/packet-tnef.c b/epan/dissectors/packet-tnef.c index f987e83de0..b5fbd33697 100644 --- a/epan/dissectors/packet-tnef.c +++ b/epan/dissectors/packet-tnef.c @@ -363,6 +363,7 @@ static void dissect_mapiprops(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre offset += 2; if(tag & 0x80000000) { + const guint8* name_string = NULL; /* it is a named property */ proto_tree_add_item(tag_tree, hf_tnef_property_tag_set, tvb, offset, 16, ENC_LITTLE_ENDIAN); @@ -375,26 +376,24 @@ static void dissect_mapiprops(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre if(tag_kind == 0) { proto_tree_add_item(tag_tree, hf_tnef_property_tag_name_id, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - - proto_item_append_text(prop_item, " [Named Property]"); } else { - char *name_string = NULL; - tag_length = tvb_get_letohl(tvb, offset); proto_tree_add_item(tag_tree, hf_tnef_property_tag_name_length, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; - proto_tree_add_item(tag_tree, hf_tnef_property_tag_name_string, tvb, offset, tag_length, ENC_UTF_16|ENC_LITTLE_ENDIAN); + proto_tree_add_item_ret_string(tag_tree, hf_tnef_property_tag_name_string, tvb, offset, tag_length, + ENC_UTF_16|ENC_LITTLE_ENDIAN, wmem_packet_scope(), &name_string); offset += tag_length; if((padding = (4 - tag_length % 4)) != 4) { proto_tree_add_item(tag_tree, hf_tnef_property_padding, tvb, offset, padding, ENC_NA); offset += padding; } - - proto_item_append_text(prop_item, " [Named Property: %s]", name_string); - } + proto_item_append_text(prop_item, " [Named Property"); + if (name_string) + proto_item_append_text(prop_item, ": %s", name_string); + proto_item_append_text(prop_item, "]"); } switch(tag) { |