From 73c7fcab1ecaed8bcc5dcc96a9a490a2c95c63cd Mon Sep 17 00:00:00 2001 From: Martin Mathieson Date: Sat, 27 Jan 2024 16:50:55 +0000 Subject: [PATCH] Check that string items have display set to BASE_NONE --- epan/dissectors/packet-ged125.c | 2 +- epan/dissectors/packet-idn.c | 2 +- epan/dissectors/packet-isup.c | 28 ++++++++++++++-------------- epan/dissectors/packet-lbmc.c | 8 ++++---- epan/dissectors/packet-oran.c | 2 +- epan/dissectors/packet-scte35.c | 4 ++-- epan/dissectors/packet-syslog.c | 14 +++++++------- epan/dissectors/packet-waveagent.c | 16 ++++++++-------- epan/dissectors/packet-wisun.c | 2 +- tools/check_typed_item_calls.py | 10 ++++++++++ 10 files changed, 49 insertions(+), 39 deletions(-) diff --git a/epan/dissectors/packet-ged125.c b/epan/dissectors/packet-ged125.c index ce2aeceff1..8609db75f6 100644 --- a/epan/dissectors/packet-ged125.c +++ b/epan/dissectors/packet-ged125.c @@ -1510,7 +1510,7 @@ proto_register_ged125 (void) { &hf_ged125_floating_payload_strg, { "Floating Payload", "ged125.floating_payload.strg", - FT_STRING, FT_NONE, NULL, 0x0, NULL, HFILL }}, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_ged125_floating_payload_uint, { "Floating Payload", "ged125.floating_payload.uint", diff --git a/epan/dissectors/packet-idn.c b/epan/dissectors/packet-idn.c index b107cc5c29..15593babd3 100644 --- a/epan/dissectors/packet-idn.c +++ b/epan/dissectors/packet-idn.c @@ -1279,7 +1279,7 @@ void proto_register_idn(void) { }, { &hf_idn_name, { "Name", "idn.name", - FT_STRING, ENC_ASCII, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, diff --git a/epan/dissectors/packet-isup.c b/epan/dissectors/packet-isup.c index e3b0e0eaec..b0a0e64e6a 100644 --- a/epan/dissectors/packet-isup.c +++ b/epan/dissectors/packet-isup.c @@ -11689,72 +11689,72 @@ proto_register_isup(void) { &hf_isup_called, { "Called Party Number", "isup.called", - FT_STRING, ENC_ASCII, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_isup_calling, { "Calling Party Number", "isup.calling", - FT_STRING, ENC_ASCII, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_isup_redirecting, { "Redirecting Number", "isup.redirecting", - FT_STRING, ENC_ASCII, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_isup_redirection_number, { "Redirection Number", "isup.redirection_number", - FT_STRING, ENC_ASCII, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_isup_subsequent_number, { "Subsequent Number", "isup.subsequent_number", - FT_STRING, ENC_ASCII, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_isup_connected_number, { "Connected Number", "isup.connected_number", - FT_STRING, ENC_ASCII, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_isup_transit_network_selection, { "Transit Network Selection", "isup.transit_network_selection", - FT_STRING, ENC_ASCII, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_isup_original_called_number, { "Original Called Number", "isup.original_called_number", - FT_STRING, ENC_ASCII, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_isup_location_number, { "Location Number", "isup.location_number", - FT_STRING, ENC_ASCII, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_isup_call_transfer_number, { "Call Transfer Number", "isup.call_transfer_number", - FT_STRING, ENC_ASCII, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_isup_called_in_number, { "Called IN Number", "isup.called_in_number", - FT_STRING, ENC_ASCII, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_isup_generic_number, { "Generic Number", "isup.generic_number", - FT_STRING, ENC_ASCII, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_isup_jurisdiction, { "Jurisdiction", "isup.jurisdiction", - FT_STRING, ENC_ASCII, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_isup_charge_number, { "Charge Number", "isup.charge_number", - FT_STRING, ENC_ASCII, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_isup_apm_msg_fragments, diff --git a/epan/dissectors/packet-lbmc.c b/epan/dissectors/packet-lbmc.c index 66ba80e014..4589857cb3 100644 --- a/epan/dissectors/packet-lbmc.c +++ b/epan/dissectors/packet-lbmc.c @@ -13962,11 +13962,11 @@ void proto_register_lbmc(void) { &hf_lbmc_extopt_cfgopt_parent, { "Parent", "lbmc.extopt.cfgopt.parent", FT_UINT64, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_lbmc_extopt_cfgopt_name, - { "Name", "lbmc.extopt.cfgopt.name", FT_STRING, FT_NONE, NULL, 0x0, NULL, HFILL } }, + { "Name", "lbmc.extopt.cfgopt.name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_lbmc_extopt_cfgopt_value, - { "Value", "lbmc.extopt.cfgopt.value", FT_STRING, FT_NONE, NULL, 0x0, NULL, HFILL } }, + { "Value", "lbmc.extopt.cfgopt.value", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_lbmc_extopt_msgsel, - { "Message Selector", "lbmc.extopt.msgsel", FT_STRING, FT_NONE, NULL, 0x0, NULL, HFILL } }, + { "Message Selector", "lbmc.extopt.msgsel", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_lbmc_extopt_reassembled_data, { "EXTOPT Reassembled Data", "lbmc.extopt.reassembled_data", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_lbmc_extopt_reassembled_data_subtype, @@ -13976,7 +13976,7 @@ void proto_register_lbmc(void) { &hf_lbmc_extopt_reassembled_data_data, { "Data", "lbmc.extopt.reassembled_data.data", FT_BYTES, FT_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_lbmc_extopt_reassembled_data_msgsel, - { "Message Selector", "lbmc.extopt.reassembled_data.msgsel", FT_STRING, FT_NONE, NULL, 0x0, NULL, HFILL } }, + { "Message Selector", "lbmc.extopt.reassembled_data.msgsel", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_lbm_msg_properties, { "Message Properties", "lbmc.lbm_msg_properties", FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_lbm_msg_properties_data, diff --git a/epan/dissectors/packet-oran.c b/epan/dissectors/packet-oran.c index 938cb93a6b..85ef647a8e 100644 --- a/epan/dissectors/packet-oran.c +++ b/epan/dissectors/packet-oran.c @@ -4035,7 +4035,7 @@ proto_register_oran(void) /* Puncturing patters as appears in SE 20 */ {&hf_oran_puncPattern, {"puncPattern", "oran_fh_cus.puncPattern", - FT_STRING, FT_NONE, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL} diff --git a/epan/dissectors/packet-scte35.c b/epan/dissectors/packet-scte35.c index e80f5bd822..317a31b0f4 100644 --- a/epan/dissectors/packet-scte35.c +++ b/epan/dissectors/packet-scte35.c @@ -1391,7 +1391,7 @@ proto_register_scte35(void) FT_UINT8, BASE_HEX, NULL, 0x1F, NULL, HFILL}}, {&hf_descriptor_dtmf, {"DTMF", "scte35.splice_descriptor.dtmf", - FT_STRING, 0, NULL, 0, NULL, HFILL}}, + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL}}, /* segmentation_descriptor */ {&hf_descriptor_event_id, @@ -1452,7 +1452,7 @@ proto_register_scte35(void) FT_UINT8, BASE_DEC, NULL, 0, NULL, HFILL}}, {&hf_descriptor_segmentation_upid, {"UPID", "scte35.splice_descriptor.upid", - FT_STRING, 0, NULL, 0, NULL, HFILL}}, + FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL}}, {&hf_descriptor_segmentation_type_id, {"Segmentation Type", "scte35.splice_descriptor.segmentation_type_id", FT_UINT8, BASE_HEX | BASE_RANGE_STRING, diff --git a/epan/dissectors/packet-syslog.c b/epan/dissectors/packet-syslog.c index 72d6812e77..fb36658423 100644 --- a/epan/dissectors/packet-syslog.c +++ b/epan/dissectors/packet-syslog.c @@ -330,12 +330,12 @@ void proto_register_syslog(void) static hf_register_info hf[] = { { &hf_syslog_facility, { "Facility", "syslog.facility", - FT_UINT8, BASE_DEC, VALS(syslog_facility_vals), FACILITY_MASK, + FT_UINT16, BASE_DEC, VALS(syslog_facility_vals), FACILITY_MASK, "Message facility", HFILL } }, { &hf_syslog_level, { "Level", "syslog.level", - FT_UINT8, BASE_DEC, VALS(syslog_level_vals), PRIORITY_MASK, + FT_UINT16, BASE_DEC, VALS(syslog_level_vals), PRIORITY_MASK, "Message level", HFILL } }, { &hf_syslog_msg, @@ -363,31 +363,31 @@ void proto_register_syslog(void) }, { &hf_syslog_timestamp_old, { "Syslog timestamp (RFC3164)", "syslog.timestamp_rfc3164", - FT_STRING, ENC_ASCII, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_syslog_hostname, { "Syslog hostname", "syslog.hostname", - FT_STRING, ENC_ASCII, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_syslog_appname, { "Syslog app name", "syslog.appname", - FT_STRING, ENC_ASCII, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, "The name of the app that generated this message", HFILL } }, { &hf_syslog_procid, { "Syslog process id", "syslog.procid", - FT_STRING, ENC_ASCII, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_syslog_msgid, { "Syslog message id", "syslog.msgid", - FT_STRING, ENC_ASCII, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, diff --git a/epan/dissectors/packet-waveagent.c b/epan/dissectors/packet-waveagent.c index 86ff3c6d46..b218cb85c5 100644 --- a/epan/dissectors/packet-waveagent.c +++ b/epan/dissectors/packet-waveagent.c @@ -1261,17 +1261,17 @@ void proto_register_waveagent(void) { &hf_waveagent_id, { "ID", "waveagent.id", - FT_STRING, 0, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_waveagent_bindtag, { "Binding Tag", "waveagent.bindtag", - FT_STRING, 0, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_waveagent_version, { "Version", "waveagent.version", - FT_STRING, 0, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_waveagent_brokerip, @@ -1330,7 +1330,7 @@ void proto_register_waveagent(void) { &hf_waveagent_statusstring, { "Status Message", "waveagent.statmsg", - FT_STRING, 0, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, /* END: Command response message fields */ @@ -1617,7 +1617,7 @@ void proto_register_waveagent(void) { &hf_waveagent_ifwlanssid, { "WLAN Interface Connected to SSID", "waveagent.ifwlanssid", - FT_STRING, 0, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_waveagent_ifwlanrssi, @@ -1670,7 +1670,7 @@ void proto_register_waveagent(void) { &hf_waveagent_ifdescription, { "Name/Description of the adapter", "waveagent.ifdescription", - FT_STRING, 0, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_waveagent_ifmacaddr, @@ -1753,7 +1753,7 @@ void proto_register_waveagent(void) { &hf_waveagent_scanssid, { "SSID", "waveagent.scanssid", - FT_STRING, 0, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, { &hf_waveagent_ifwlansupprates, @@ -1790,7 +1790,7 @@ void proto_register_waveagent(void) { &hf_waveagent_oidvalue, { "OID Value", "waveagent.oidvalue", - FT_STRING, 0, NULL, 0x0, + FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, /* END: OID fields */ diff --git a/epan/dissectors/packet-wisun.c b/epan/dissectors/packet-wisun.c index a5ae41ded4..0133cf712b 100644 --- a/epan/dissectors/packet-wisun.c +++ b/epan/dissectors/packet-wisun.c @@ -2323,7 +2323,7 @@ void proto_register_wisun(void) }, { &hf_wisun_netnameie_name, - { "Network Name", "wisun.netnameie.name", FT_STRING, ENC_ASCII, NULL, 0x0, + { "Network Name", "wisun.netnameie.name", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL } }, diff --git a/tools/check_typed_item_calls.py b/tools/check_typed_item_calls.py index d7683cc19d..992ce93274 100755 --- a/tools/check_typed_item_calls.py +++ b/tools/check_typed_item_calls.py @@ -1264,6 +1264,14 @@ class Item: errors_found += 1 # TODO: check for length > 64? + def check_string_display(self): + global warnings_found + if self.item_type in { 'FT_STRING', 'FT_STRINGZ', 'FT_UINT_STRING'}: + if self.display != 'BASE_NONE': + print('Warning:', self.filename, self.hf, 'type is', self.item_type, 'display must be BASE_NONE, is instead', self.display) + warnings_found += 1 + + class CombinedCallsCheck: @@ -1685,6 +1693,8 @@ def checkFile(filename, check_mask=False, mask_exact_width=False, check_label=Fa for hf in items_defined: items_defined[hf].check_boolean_length() + items_defined[hf].check_string_display() +