Checked encoded values for proto_tree_add_item()

This commit is contained in:
Martin Mathieson 2023-01-21 11:16:20 +00:00
parent 2bde511bb5
commit c84a54c82f
16 changed files with 87 additions and 87 deletions

View File

@ -4728,10 +4728,7 @@ static guint32
dissect_acn_blob(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *pdu_tree, int blob_offset, int end_offset)
{
/* Declarations for blobs*/
guint8 version;
guint8 range;
guint8 blob_type;
guint8 range_number;
guint16 field_number = 1;
proto_item *bi;
proto_tree *blob_tree = NULL;
@ -4745,19 +4742,16 @@ dissect_acn_blob(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *pdu_tree, in
blob_offset += 4;
/* Add Blob version item to tree */
version = tvb_get_guint8(tvb, blob_offset);
proto_tree_add_item(blob_tree, hf_acn_blob_version, tvb, blob_offset, 1, version);
proto_tree_add_item(blob_tree, hf_acn_blob_version, tvb, blob_offset, 1, ENC_BIG_ENDIAN);
blob_offset += 1;
/* Add Blob Start and End Range Info */
range = tvb_get_guint8(tvb, blob_offset);
proto_tree_add_item(blob_tree, hf_acn_blob_range_type, tvb, blob_offset, 1, range);
proto_tree_add_item(blob_tree, hf_acn_blob_range_type, tvb, blob_offset, 1, ENC_BIG_ENDIAN);
/* range_type = val_to_str(range, acn_blob_range_type_vals, "not valid (%d)"); */
blob_offset += 1;
/* Add Blob Range Number */
range_number = tvb_get_guint8(tvb, blob_offset);
proto_tree_add_item(blob_tree, hf_acn_blob_range_number, tvb, blob_offset, 1, range_number);
proto_tree_add_item(blob_tree, hf_acn_blob_range_number, tvb, blob_offset, 1, ENC_BIG_ENDIAN);
blob_offset += 1;
/* Add Blob Meta-Type */
@ -4767,7 +4761,7 @@ dissect_acn_blob(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *pdu_tree, in
blob_type = get_blob_type_from_fields(tvb, blob_offset + 1, end_offset);
}
proto_tree_add_item(blob_tree, hf_acn_blob_type, tvb, blob_offset, 1, blob_type);
proto_tree_add_uint(blob_tree, hf_acn_blob_type, tvb, blob_offset, 1, blob_type);
blob_name = val_to_str(blob_type, acn_blob_type_vals, "not valid (%d)");
proto_item_append_text(bi, ": %s", blob_name);

View File

@ -2292,8 +2292,7 @@ static const aim_tlv aim_motd_tlvs[] = {
static int dissect_aim_generic_motd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *gen_tree)
{
int offset = 0;
proto_tree_add_item(gen_tree, hf_generic_motd_motdtype, tvb, offset,
2, tvb_get_ntohs(tvb, offset));
proto_tree_add_item(gen_tree, hf_generic_motd_motdtype, tvb, offset, 2, ENC_BIG_ENDIAN);
offset+=2;
return dissect_aim_tlv_sequence(tvb, pinfo, offset, gen_tree, aim_motd_tlvs);
}

View File

@ -600,7 +600,7 @@ dissect_amp_as_subtree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
//amp_control_sub_tree = proto_item_add_subtree(amp_message_tree, ett_amp);
amp_control_tree = proto_tree_add_subtree(amp_message_tree, tvb, offset-1, -1,
ett_amp_message, &amp_message, "Perform-Control");
proto_tree_add_item(amp_control_tree, hf_amp_cbor_header, tvb, offset, 1, 0x00);
proto_tree_add_item(amp_control_tree, hf_amp_cbor_header, tvb, offset, 1, ENC_BIG_ENDIAN);
break;
case 0x03: // Table Set
@ -608,7 +608,7 @@ dissect_amp_as_subtree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
//amp_table_sub_tree = proto_item_add_subtree(amp_items_tree, ett_amp);
amp_table_tree = proto_tree_add_subtree(amp_items_tree, tvb, offset, -1,
ett_amp_message, &amp_message, "AMP Message: Table-Set");
proto_tree_add_item(amp_table_tree, hf_amp_cbor_header, tvb, offset, 1, 0x00);
proto_tree_add_item(amp_table_tree, hf_amp_cbor_header, tvb, offset, 1, ENC_BIG_ENDIAN);
break;
default:
break;

View File

@ -907,7 +907,7 @@ static int dissect_isi_sim(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitre
next_tvb = tvb_new_subset_remaining(tvb, 0);
proto_tree_add_item(tree, hf_isi_sim_imsi_byte_1, next_tvb, 4, 1, ENC_LITTLE_ENDIAN);
dissect_e212_mcc_mnc(next_tvb, pinfo, tree, 4, FALSE );
proto_tree_add_item(tree, hf_E212_msin, tvb, 2, 7, FALSE);
proto_tree_add_item(tree, hf_E212_msin, tvb, 2, 7, ENC_BIG_ENDIAN);
*/
@ -1100,7 +1100,7 @@ static int dissect_isi_gss(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitre
break;
case 0x01: /* GSS_CS_SERVICE_RESP */
/* proto_tree_add_item(tree, hf_isi_gss_service_type, tvb, 1, 1, FALSE); */
/* proto_tree_add_item(tree, hf_isi_gss_service_type, tvb, 1, 1, ENC_NA); */
code = tvb_get_guint8(tvb, 1);
switch(code) {
/* case 0x9C:
@ -1359,7 +1359,7 @@ static int dissect_isi_ss(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree
break;
case 0x02: /* SS_SERVICE_FAILED_RESP */
/* proto_tree_add_item(tree, hf_isi_ss_service_type, tvb, 1, 1, FALSE); */
/* proto_tree_add_item(tree, hf_isi_ss_service_type, tvb, 1, 1, ENC_NA); */
code = tvb_get_guint8(tvb, 1);
switch(code) {
/* case 0x2F:
@ -1389,7 +1389,7 @@ static int dissect_isi_ss(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitree
break;
case 0x05: /* SS_GSM_USSD_SEND_RESP */
/* proto_tree_add_item(tree, hf_isi_ss_service_type, tvb, 1, 1, FALSE); */
/* proto_tree_add_item(tree, hf_isi_ss_service_type, tvb, 1, 1, ENC_NA); */
code = tvb_get_guint8(tvb, 1);
switch(code) {
/* case 0x2F:
@ -1670,7 +1670,7 @@ static int dissect_isi_sms(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitre
break;
case 0x07: /* SMS_PP_ROUTING_RESP */
/* proto_tree_add_item(tree, hf_isi_sms_service_type, tvb, 1, 1, FALSE); */
/* proto_tree_add_item(tree, hf_isi_sms_service_type, tvb, 1, 1, ENC_NA); */
code = tvb_get_guint8(tvb, 1);
switch(code) {
/* case 0x2F:
@ -1686,10 +1686,10 @@ static int dissect_isi_sms(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitre
proto_tree_add_item(tree, hf_isi_sms_routing_command, tvb, 1, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tree, hf_isi_sms_routing_mode, tvb, 2, 1, ENC_BIG_ENDIAN);
#if 0
proto_tree_add_item(tree, hf_isi_sms_cb_subject_list_type, tvb, 3, 1, FALSE);
proto_tree_add_item(tree, hf_isi_sms_cb_subject_count, tvb, 4, 1, FALSE);
proto_tree_add_item(tree, hf_isi_sms_cb_language_count, tvb, 5, 1, FALSE);
proto_tree_add_item(tree, hf_isi_sms_cb_range, tvb, 6, 1, FALSE);
proto_tree_add_item(tree, hf_isi_sms_cb_subject_list_type, tvb, 3, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tree, hf_isi_sms_cb_subject_count, tvb, 4, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tree, hf_isi_sms_cb_language_count, tvb, 5, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tree, hf_isi_sms_cb_range, tvb, 6, 1, ENC_BIG_ENDIAN);
#endif
code = tvb_get_guint8(tvb, 1);
switch(code) {
@ -1707,8 +1707,8 @@ static int dissect_isi_sms(tvbuff_t *tvb, packet_info *pinfo, proto_item *isitre
case 0x0C: /* SMS_GSM_CB_ROUTING_RESP */
#if 0
proto_tree_add_item(tree, hf_isi_sms_operation, tvb, 1, 1, FALSE);
proto_tree_add_item(tree, hf_isi_sms_service_code, tvb, 2, 1, FALSE);
proto_tree_add_item(tree, hf_isi_sms_operation, tvb, 1, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(tree, hf_isi_sms_service_code, tvb, 2, 1, ENC_BIG_ENDIAN);
#endif
code = tvb_get_guint8(tvb, 1);
switch(code) {

View File

@ -2260,14 +2260,15 @@ wlantap_dissect_octo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
tvbuff_t *next_tvb;
guint length;
gint8 dbm;
guint8 rate_mcs_index = 0, vw_plcp_info, vw_bssid;
guint8 rate_mcs_index = 0, vw_bssid;
guint8 plcp_type;
guint8 vht_ndp_flag, vht_mu_mimo_flg;
float phyRate;
proto_tree *vwict, *vw_infoC_tree = NULL;
guint16 vw_vcid, vw_seqnum, mpdu_length;
guint8 vht_user_pos;
guint16 vw_vcid, mpdu_length;
guint32 vw_seqnum;
guint32 vht_user_pos;
guint8 plcp_default;
proto_item *vwl1i;
@ -2500,10 +2501,9 @@ wlantap_dissect_octo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (plcp_type == PLCP_TYPE_VHT_MIXED)
{
// Extract SU/MU MIMO flag from RX L1 Info
vht_user_pos = tvb_get_guint8(tvb, offset);
vht_user_pos = tvb_get_guint8(tvb, offset);
vwict = proto_tree_add_item(vw_l1info_tree,
hf_radiotap_l1infoc, tvb, offset, 1, vht_user_pos);
hf_radiotap_l1infoc, tvb, offset, 1, ENC_NA);
vw_infoC_tree = proto_item_add_subtree(vwict, ett_radiotap_infoc);
vht_ndp_flag = (vht_user_pos & 0x80) >> 7;
@ -2528,14 +2528,14 @@ wlantap_dissect_octo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
mpdu_length = tvb_get_letohs(tvb, offset);
if (cmd_type != 1) //Checking for Rx and Tx
{
proto_tree_add_item(vw_l1info_tree, hf_ixveriwave_frame_length, tvb, offset, 2, mpdu_length);
proto_tree_add_item(vw_l1info_tree, hf_ixveriwave_frame_length, tvb, offset, 2, ENC_LITTLE_ENDIAN);
}
offset += 2;
//RadioTapHeader New format for PLCP section
vw_plcp_info = tvb_get_guint8(tvb, offset);
//vw_plcp_info = tvb_get_guint8(tvb, offset);
vwplt = proto_tree_add_item(tap_tree, hf_radiotap_plcp_info, tvb, offset, 16, vw_plcp_info);
vwplt = proto_tree_add_item(tap_tree, hf_radiotap_plcp_info, tvb, offset, 16, ENC_NA);
vw_plcpinfo_tree = proto_item_add_subtree(vwplt, ett_radiotap_plcp);
switch (plcp_type)
@ -2832,9 +2832,8 @@ wlantap_dissect_octo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item(vw_l2l4info_tree, hf_radiotap_flowvalid, tvb, offset, 1, ENC_NA);
offset++;
vw_seqnum = tvb_get_guint8(tvb, offset);
proto_tree_add_item(vw_l2l4info_tree, hf_ixveriwave_vw_seqnum,
tvb, offset, 1, vw_seqnum);
proto_tree_add_item_ret_uint(vw_l2l4info_tree, hf_ixveriwave_vw_seqnum,
tvb, offset, 1, ENC_NA, &vw_seqnum);
offset++;
if (flowv == 1)
{

View File

@ -9277,7 +9277,7 @@ dissect_nfs4_write_response(tvbuff_t *tvb, int offset, proto_tree *tree)
subtree = proto_item_add_subtree(sub_fitem, ett_nfs4_callback_stateids_sub);
for (i = 0; i < count; i++) {
ss_fitem = proto_tree_add_item(subtree,
ss_fitem = proto_tree_add_uint(subtree,
hf_nfs4_callback_stateids_index,
tvb, offset, 4, i);
@ -9310,7 +9310,7 @@ dissect_nfs4_source_servers(tvbuff_t *tvb, int offset, proto_tree *tree)
subtree = proto_item_add_subtree(sub_fitem, ett_nfs4_source_servers_sub);
for (i = 0; i < source_servers; i++) {
ss_fitem = proto_tree_add_item(subtree,
ss_fitem = proto_tree_add_uint(subtree,
hf_nfs4_source_server_index,
tvb, offset, 4, i);

View File

@ -1913,7 +1913,7 @@ proto_register_oran(void)
{ "Data Direction", "oran_fh_cus.data_direction",
FT_UINT8, BASE_DEC,
VALS(data_direction_vals), 0x80,
"This parameter indicates the gNB data direction.",
"This parameter indicates the gNB data direction",
HFILL }
},
@ -1924,7 +1924,7 @@ proto_register_oran(void)
NULL, 0x70,
"This parameter defines the payload protocol version valid for the "
"following IEs in the application layer. In this version of the "
"specification payloadVersion=001b shall be used.",
"specification payloadVersion=001b shall be used",
HFILL}
},
@ -1945,7 +1945,7 @@ proto_register_oran(void)
"also a frequency offset (see freqOffset) applied before the "
"PRACH filter. NOTE: Filter index is commanded from lls-CU to RU. "
"Likewise, it is not mandatory to command special filters, and "
"filter index = 0000b is also allowed for PRACH.",
"filter index = 0000b is also allowed for PRACH",
HFILL}
},
@ -1976,7 +1976,7 @@ proto_register_oran(void)
"in one sub-frame are counted by this parameter, slotId running "
"from 0 to Nslot-1. In this version of the specification the "
"maximum Nslot=16, All other values of the 6 bits are reserved for "
"future use.",
"future use",
HFILL}
},
@ -1995,7 +1995,7 @@ proto_register_oran(void)
FT_UINT8, BASE_DEC,
NULL, 0x3f,
"This parameter identifies the first symbol number within slot, to "
"which the information of this message is applies.",
"which the information of this message is applies",
HFILL}
},
@ -2015,7 +2015,7 @@ proto_register_oran(void)
FT_UINT8, BASE_DEC | BASE_RANGE_STRING,
RVALS(section_types), 0x00,
"This parameter determines the characteristics of U-plane data to "
"be transferred or received from a beam with one pattern id.",
"be transferred or received from a beam with one pattern id",
HFILL}
},
@ -2530,8 +2530,8 @@ proto_register_oran(void)
{ "beamforming weight compression parameter", "oran_fh_cus.bfwCompParam",
various, | BASE_RANGE_STRING,
RVALS(bfw_comp_parms), 0x0,
"This parameter applies to the compression method specified by th"
"e associated sectionID's bfwCompMeth value.",
"This parameter applies to the compression method specified by the"
"associated sectionID's bfwCompMeth value",
HFILL }
},
#endif
@ -2601,7 +2601,7 @@ proto_register_oran(void)
{"Pair", "oran_fh_cus.offStartPrb_numPrb",
FT_STRING, BASE_NONE,
NULL, 0x0,
"Pair of offStartPrb and numPrb.",
"Pair of offStartPrb and numPrb",
HFILL}
},
@ -2609,14 +2609,14 @@ proto_register_oran(void)
{"offStartPrb", "oran_fh_cus.offStartPrb",
FT_UINT8, BASE_DEC,
NULL, 0x0,
"Offset of PRB range start.",
"Offset of PRB range start",
HFILL}
},
{&hf_oran_num_prb,
{"numPrb", "oran_fh_cus.numPrb",
FT_UINT8, BASE_DEC,
NULL, 0x0,
"Number of PRBs in PRB range.",
"Number of PRBs in PRB range",
HFILL}
},
@ -2637,27 +2637,26 @@ proto_register_oran(void)
"This parameter is the starting PRB of a user plane section. For "
"one C-Plane message, there may be multiple U-Plane messages "
"associated with it and requiring defining from which PRB the contained "
"IQ data are applicable.",
"IQ data are applicable",
HFILL}
},
/* Section 6.3.3.12 */
{&hf_oran_numPrbu,
{ &hf_oran_numPrbu,
{"Number of PRBs per User Plane Section", "oran_fh_cus.numPrbu",
FT_UINT8, BASE_DEC,
NULL, 0x0,
"This parameter defines the PRBs where the user plane section is "
"valid.",
"This parameter defines the PRBs where the user plane section is valid",
HFILL}
},
/* Section 6.3.3.13 */
{&hf_oran_udCompHdrMeth,
{ &hf_oran_udCompHdrMeth,
{"User Data Compression Method", "oran_fh_cus.udCompHdrMeth",
FT_UINT8, BASE_DEC | BASE_RANGE_STRING,
RVALS(ud_comp_header_meth), 0x0f,
"This parameter defines the compression method for "
"the user data in every section in the C-Plane message.",
"the user data in every section in the C-Plane message",
HFILL}
},
@ -2667,7 +2666,7 @@ proto_register_oran(void)
FT_UINT8, BASE_DEC | BASE_RANGE_STRING,
RVALS(ud_comp_header_width), 0xf0,
"This parameter defines the IQ bit width "
"for the user data in every section in the C-Plane message.",
"for the user data in every section in the C-Plane message",
HFILL}
},
@ -2727,7 +2726,7 @@ proto_register_oran(void)
"This parameter exponent applicable to the I & Q mantissas. "
"NOTE : Exponent is used for all mantissa sample sizes(i.e. 6bit "
"- 16bit). Likewise, a native \"uncompressed\" format is not supported "
"within this specification.",
"within this specification",
HFILL }
},
@ -2752,8 +2751,7 @@ proto_register_oran(void)
{ "RefA", "oran_fh_cus.refa",
FT_STRING, BASE_NONE,
NULL, 0x0,
"This is a calculated field for the RefA ID, which provides a "
"reference in time.",
"This is a calculated field for the RefA ID, which provides a reference in time",
HFILL }
},

View File

@ -45,13 +45,13 @@ dissect_pulse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
guint32 magic;
const char* magic_str;
guint little_endian;
guint endian;
if (tvb_captured_length(tvb) < 4)
return 0;
/* Try to read MAGIC in both endians */
little_endian = ENC_LITTLE_ENDIAN;
endian = ENC_LITTLE_ENDIAN;
magic = tvb_get_letohl(tvb, 0);
magic_str = try_val_to_str(magic, pulse_magic_type);
if (magic_str == NULL) {
@ -60,7 +60,7 @@ dissect_pulse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
if (magic_str == NULL) {
return 0;
}
little_endian = ENC_BIG_ENDIAN;
endian = ENC_BIG_ENDIAN;
}
col_set_str(pinfo->cinfo, COL_PROTOCOL, "PULSE");
@ -68,9 +68,9 @@ dissect_pulse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
if (parent_tree) {
item = proto_tree_add_item(parent_tree, proto_pulse, tvb, 0,
-1, little_endian);
-1, endian);
tree = proto_item_add_subtree(item, ett_pulse);
proto_tree_add_item(tree, hf_pulse_magic, tvb, 0, 4, little_endian);
proto_tree_add_item(tree, hf_pulse_magic, tvb, 0, 4, endian);
}
return 4;
}

View File

@ -12098,9 +12098,8 @@ static void dissect_RTPS_DATA_BATCH(tvbuff_t *tvb, packet_info *pinfo, gint offs
}
/* octetsToSLEncapsulationId */
octetsToSLEncapsulationId = tvb_get_guint32(tvb, offset, encoding);
proto_tree_add_item(tree, hf_rtps_data_batch_octets_to_sl_encap_id, tvb,
offset, 4, octetsToSLEncapsulationId);
proto_tree_add_item_ret_uint(tree, hf_rtps_data_batch_octets_to_sl_encap_id, tvb,
offset, 4, encoding, &octetsToSLEncapsulationId);
offset += 4;
sampleListOffset = offset + octetsToSLEncapsulationId;

View File

@ -652,7 +652,7 @@ dissect_osd_offset(packet_info *pinfo, tvbuff_t *tvb, int offset,
exponent = -(((~exponent)&7)+1);
if (exponent <=- 6 && mantissa != 0xFFFFFFF) {
proto_item *item;
item = proto_tree_add_item(tree, field, tvb, offset, 4, value);
item = proto_tree_add_uint(tree, field, tvb, offset, 4, value);
expert_add_info(pinfo, item, &ei_osd2_invalid_offset);
*raw_value_ptr = 0xFFFFFFFF;
return;

View File

@ -844,7 +844,7 @@ dissect_loginserv_packet(struct tibia_convo *convo, tvbuff_t *tvb, int offset, i
proto_item *it = ptvcursor_add(ptvc, hf_tibia_worldlist_entry_id, 1, ENC_NA);
ptvcursor_push_subtree(ptvc, it, ett_world);
ptvcursor_add(ptvc, hf_tibia_worldlist_entry_name, 2, convo->has.string_enc | ENC_LITTLE_ENDIAN);
ptvcursor_add(ptvc, hf_tibia_worldlist_entry_name, 2, ENC_LITTLE_ENDIAN | convo->has.string_enc);
guint ipv4addr_len = tvb_get_letohs(tvb, ptvcursor_current_offset(ptvc));
char *ipv4addr_str = (char*)tvb_get_string_enc(pinfo->pool, tvb, ptvcursor_current_offset(ptvc) + 2, ipv4addr_len, ENC_LITTLE_ENDIAN | convo->has.string_enc);
guint32 ipv4addr = ipv4tonl(ipv4addr_str);
@ -867,7 +867,7 @@ dissect_loginserv_packet(struct tibia_convo *convo, tvbuff_t *tvb, int offset, i
while (char_count--) {
proto_item *it = ptvcursor_add(ptvc, hf_tibia_worldlist_entry_id, 1, ENC_NA);
ptvcursor_push_subtree(ptvc, it, ett_char);
ptvcursor_add(ptvc, hf_tibia_charlist_entry_name, 2, convo->has.string_enc | ENC_LITTLE_ENDIAN);
ptvcursor_add(ptvc, hf_tibia_charlist_entry_name, 2, ENC_LITTLE_ENDIAN | convo->has.string_enc);
ptvcursor_pop_subtree(ptvc);
@ -881,7 +881,7 @@ dissect_loginserv_packet(struct tibia_convo *convo, tvbuff_t *tvb, int offset, i
ptvcursor_add_with_subtree(ptvc, hf_tibia_charlist, SUBTREE_UNDEFINED_LENGTH, ENC_NA, ett_charlist);
while (char_count--) {
proto_item *it = ptvcursor_add(ptvc, hf_tibia_charlist_entry_name, 2, convo->has.string_enc | ENC_LITTLE_ENDIAN);
proto_item *it = ptvcursor_add(ptvc, hf_tibia_charlist_entry_name, 2, ENC_LITTLE_ENDIAN | convo->has.string_enc);
ptvcursor_push_subtree(ptvc, it, ett_char);
ptvcursor_add(ptvc, hf_tibia_charlist_entry_world, 2, ENC_LITTLE_ENDIAN | convo->has.string_enc);
@ -1566,7 +1566,7 @@ dissect_tibia(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *fragmen
proto_tree_add_item(infotree, hf_tibia_unknown, tvb_decrypted, offset, 4, ENC_NA);
offset += 4;
proto_tree_add_item(infotree, hf_tibia_client_gpu, tvb_decrypted, offset, 9, convo->has.string_enc|ENC_NA);
proto_tree_add_item(infotree, hf_tibia_client_gpu, tvb_decrypted, offset, 9, ENC_NA | convo->has.string_enc);
offset += 9;
proto_tree_add_item(infotree, hf_tibia_client_vram, tvb_decrypted, offset, 2, ENC_LITTLE_ENDIAN);

View File

@ -694,7 +694,7 @@ static void dissect_tns_data(tvbuff_t *tvb, int offset, packet_info *pinfo, prot
proto_tree_add_item(data_tree, hf_tns_data_opi_version2_banner, tvb, offset, len, ENC_ASCII);
offset += len + (skip == 1 ? 1 : 0);
proto_tree_add_item(data_tree, hf_tns_data_opi_version2_vsnum, tvb, offset, 4, skip == 1 ? ENC_BIG_ENDIAN : ENC_LITTLE_ENDIAN);
proto_tree_add_item(data_tree, hf_tns_data_opi_version2_vsnum, tvb, offset, 4, (skip == 1) ? ENC_BIG_ENDIAN : ENC_LITTLE_ENDIAN);
offset += 4;
}
else if ( opi == OPI_OSESSKEY || opi == OPI_OAUTH )

View File

@ -814,7 +814,7 @@ static void dissect_uftp_keyinfo(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr
offset += 1;
proto_tree_add_item(keyinfo_tree, hf_uftp_keyinfo_groupmaster_len, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(keyinfo_tree, hf_uftp_keyinfo_tstamp, tvb, offset, 8, FALSE);
proto_tree_add_item(keyinfo_tree, hf_uftp_keyinfo_tstamp, tvb, offset, 8, ENC_NA);
offset += 8;
if (destcount > 0) {
destlist = proto_tree_add_item(keyinfo_tree, hf_uftp_destlist, tvb, offset, destcount * DESTKEY_LEN, ENC_NA);
@ -1337,7 +1337,7 @@ static void dissect_uftp_encrypted(tvbuff_t *tvb, packet_info *pinfo _U_, proto_
ti = proto_tree_add_item(tree, hf_uftp_encrypted, tvb, offset, -1, ENC_NA);
encrypted_tree = proto_item_add_subtree(ti, ett_uftp_encrypted);
proto_tree_add_item(encrypted_tree, hf_uftp_encrypted_tstamp, tvb, offset, 8, FALSE);
proto_tree_add_item(encrypted_tree, hf_uftp_encrypted_tstamp, tvb, offset, 8, ENC_NA);
offset += 8;
proto_tree_add_item(encrypted_tree, hf_uftp_encrypted_sig_len, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;

View File

@ -1611,12 +1611,11 @@ static guint32 vsip_ErrorVAResponse(proto_tree *tree, packet_info *pinfo, tvbuff
static guint32 vsip_dissect_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
int soffset = offset;
guint16 version;
guint32 version;
guint8 type;
proto_item *ti;
version = tvb_get_ntohs(tvb, offset);
proto_tree_add_item(tree, hf_vsip_Version, tvb, offset, 2, version);
proto_tree_add_item_ret_uint(tree, hf_vsip_Version, tvb, offset, 2, ENC_BIG_ENDIAN, &version);
offset += 2;
type = tvb_get_guint8(tvb, offset);
@ -1632,7 +1631,7 @@ static guint32 vsip_dissect_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo, p
proto_tree_add_item(tree, hf_vsip_PacketSize, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
}
else if(version == 256)
else if (version == 256)
{
proto_tree_add_item(tree, hf_vsip_PacketSize, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;

View File

@ -5622,7 +5622,7 @@ static int dissect_mu_netflow(proto_tree *tree, tvbuff_t *tvb, int offset)
proto_tree_add_item(mu_netflow_header_tree, hf_wassp_mu_netflow_version, tvb, MU_NETFLOW_HDR_VERSION, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(mu_netflow_header_tree, hf_wassp_mu_netflow_length, tvb, MU_NETFLOW_HDR_LENGTH, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(mu_netflow_header_tree, hf_wassp_mu_netflow_flags, tvb, MU_NETFLOW_HDR_FLAG, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(mu_netflow_header_tree, hf_wassp_mu_netflow_uptime, tvb, MU_NETFLOW_HDR_UPTIME, 4, FALSE);
proto_tree_add_item(mu_netflow_header_tree, hf_wassp_mu_netflow_uptime, tvb, MU_NETFLOW_HDR_UPTIME, 4, ENC_NA);
offset += MU_NETFLOW_HEADER_TOTAL_LENGTH;
netflowLen = tvb_get_ntohs(tvb, MU_NETFLOW_HDR_LENGTH);

View File

@ -62,7 +62,7 @@ common_hf_var_names = { 'hf_index', 'hf_item', 'hf_idx', 'hf_x', 'hf_id', 'hf_co
'hf_cause_value', 'hf_uuid',
'hf_endian', 'hf_ip', 'hf_port', 'hf_suff', 'hf_string', 'hf_uint',
'hf_tag', 'hf_type', 'hf_hdr', 'hf_field', 'hf_opcode', 'hf_size',
'hf_entry' }
'hf_entry', 'field' }
# A check for a particular API function.
class APICheck:
@ -179,13 +179,13 @@ class ProtoTreeAddItemCheck(APICheck):
# proto_tree_add_item(proto_tree *tree, int hfindex, tvbuff_t *tvb,
# const gint start, gint length, const guint encoding)
self.fun_name = 'proto_tree_add_item'
self.p = re.compile('[^\n]*' + self.fun_name + '\([a-zA-Z0-9_]+,\s*([a-zA-Z0-9_]+),\s*[a-zA-Z0-9_]+,\s*[a-zA-Z0-9_]+,\s*([0-9]+),\s*([a-zA-Z0-9_]+)')
self.p = re.compile('[^\n]*' + self.fun_name + '\(\s*[a-zA-Z0-9_]+,\s*([a-zA-Z0-9_]+),\s*[a-zA-Z0-9_]+,\s*[a-zA-Z0-9_]+,\s*([0-9]+),\s*([a-zA-Z0-9_]+)')
else:
# proto_item *
# ptvcursor_add(ptvcursor_t *ptvc, int hfindex, gint length,
# const guint encoding)
self.fun_name = 'ptvcursor_add'
self.p = re.compile('[^\n]*' + self.fun_name + '\([a-zA-Z0-9_]+,\s*([a-zA-Z0-9_]+),\s*([a-zA-Z_0-9]+),\s*([a-zA-Z0-9_]+)')
self.p = re.compile('[^\n]*' + self.fun_name + '\([a-zA-Z0-9_]+,\s*([a-zA-Z0-9_]+),\s*([a-zA-Z_0-9]+),\s*([a-zA-Z0-9_\-\>]+)')
self.lengths = {}
@ -230,7 +230,19 @@ class ProtoTreeAddItemCheck(APICheck):
to_check += (lines[line_number-1+i] + '\n')
m = self.p.search(to_check)
if m:
self.calls.append(Call(m.group(1), line_number=line_number, length=m.group(2)))
enc = m.group(3)
hf_name = m.group(1)
if not enc.startswith('ENC_'):
if not enc in { 'encoding', 'enc', 'client_is_le', 'cigi_byte_order', 'endian', 'endianess', 'machine_encoding', 'byte_order', 'bLittleEndian',
'p_mq_parm', 'iEnc', 'strid_enc', 'iCod', 'nl_data', 'argp', 'gquic_info', 'writer_encoding',
'tds_get_int2_encoding', 'tds_get_int4_encoding',
'DREP_ENC_INTEGER' }:
global warnings_found
print('Warning:', self.file + ':' + str(line_number),
self.fun_name + ' called for "' + hf_name + '"', 'check last/enc param:', enc, '?')
warnings_found += 1
self.calls.append(Call(hf_name, line_number=line_number, length=m.group(2)))
def check_against_items(self, items_defined, items_declared, items_declared_extern, check_missing_items=False):
# For now, only complaining if length if call is longer than the item type implies.
@ -696,8 +708,9 @@ def find_items(filename, check_mask=False, mask_exact_width=False, check_label=F
contents = f.read()
# Remove comments so as not to trip up RE.
contents = removeComments(contents)
# N.B. re extends all the way to HFILL to avoid greedy matching
matches = re.finditer( r'.*\{\s*\&(hf_[a-z_A-Z0-9]*)\s*,\s*{\s*\"(.*)\"\s*,\s*\"([a-zA-Z0-9_\-\.]+)\"\s*,\s*([a-zA-Z0-9_]*)\s*,\s*(.*)\s*,\s*([\&A-Za-z0-9x\_<\|\s\(\)]*)\s*,\s*([a-zA-Z0-9x_]*)\s*,\s*.*\s*,\s*HFILL', contents)
matches = re.finditer( r'.*\{\s*\&(hf_[a-z_A-Z0-9]*)\s*,\s*{\s*\"(.*?)\"\s*,\s*\"(.*?)\"\s*,\s*(.*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*,\s*([a-zA-Z0-9\W\s_]*?)\s*,\s*HFILL', contents)
for m in matches:
# Store this item.
hf = m.group(1)
@ -707,7 +720,6 @@ def find_items(filename, check_mask=False, mask_exact_width=False, check_label=F
check_label=check_label,
mask_exact_width=mask_exact_width,
check_consecutive=(not is_generated and check_consecutive))
#print('item is', hf, items[hf])
return items