diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-26 17:44:17 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-26 17:44:17 +0000 |
commit | 2d78050fd56b8188aa5a65ad2667e301b60eea45 (patch) | |
tree | b54d4adac6de0a196b8bb8a67b34fe186c21378f /epan/dissectors/packet-cql.c | |
parent | Adding upstream version 4.2.2. (diff) | |
download | wireshark-2d78050fd56b8188aa5a65ad2667e301b60eea45.tar.xz wireshark-2d78050fd56b8188aa5a65ad2667e301b60eea45.zip |
Adding upstream version 4.2.4.upstream/4.2.4
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'epan/dissectors/packet-cql.c')
-rw-r--r-- | epan/dissectors/packet-cql.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/epan/dissectors/packet-cql.c b/epan/dissectors/packet-cql.c index 3f000a7e..32b03ec2 100644 --- a/epan/dissectors/packet-cql.c +++ b/epan/dissectors/packet-cql.c @@ -572,7 +572,8 @@ typedef enum { } cql_compression_level; -static int parse_option(proto_tree* metadata_subtree, tvbuff_t* tvb, gint offset) +// NOLINTNEXTLINE(misc-no-recursion) +static int parse_option(proto_tree* metadata_subtree, packet_info *pinfo, tvbuff_t* tvb, gint offset) { guint32 data_type = 0; guint32 string_length = 0; @@ -582,16 +583,17 @@ static int parse_option(proto_tree* metadata_subtree, tvbuff_t* tvb, gint offset proto_tree_add_item_ret_uint(metadata_subtree, hf_cql_result_rows_data_type, tvb, offset, 2, ENC_BIG_ENDIAN, &data_type); offset += 2; + increment_dissection_depth(pinfo); switch (data_type) { case CQL_RESULT_ROW_TYPE_LIST: - offset = parse_option(metadata_subtree, tvb, offset); + offset = parse_option(metadata_subtree, pinfo, tvb, offset); break; case CQL_RESULT_ROW_TYPE_MAP: - offset = parse_option(metadata_subtree, tvb, offset); - offset = parse_option(metadata_subtree, tvb, offset); + offset = parse_option(metadata_subtree, pinfo, tvb, offset); + offset = parse_option(metadata_subtree, pinfo, tvb, offset); break; case CQL_RESULT_ROW_TYPE_SET: - offset = parse_option(metadata_subtree, tvb, offset); + offset = parse_option(metadata_subtree, pinfo, tvb, offset); break; case CQL_RESULT_ROW_TYPE_UDT: /* keyspace */ @@ -618,19 +620,20 @@ static int parse_option(proto_tree* metadata_subtree, tvbuff_t* tvb, gint offset offset += string_length; /* UDT field option */ - offset = parse_option(metadata_subtree, tvb, offset); + offset = parse_option(metadata_subtree, pinfo, tvb, offset); } break; case CQL_RESULT_ROW_TYPE_TUPLE: proto_tree_add_item_ret_uint(metadata_subtree, hf_cql_result_rows_tuple_size, tvb, offset, 2, ENC_BIG_ENDIAN, &tuple_size); offset += 2; for (i = 0; i < tuple_size; i++) { - offset = parse_option(metadata_subtree, tvb, offset); + offset = parse_option(metadata_subtree, pinfo, tvb, offset); } break; default: break; } + decrement_dissection_depth(pinfo); return offset; } @@ -684,6 +687,7 @@ static void add_cql_uuid(proto_tree* tree, int hf_uuid, tvbuff_t* tvb, gint offs } +// NOLINTNEXTLINE(misc-no-recursion) static int parse_value(proto_tree* columns_subtree, packet_info *pinfo, tvbuff_t* tvb, gint* offset_metadata, gint offset) { guint32 data_type = 0; @@ -722,6 +726,7 @@ static int parse_value(proto_tree* columns_subtree, packet_info *pinfo, tvbuff_t return offset; } + increment_dissection_depth(pinfo); switch (data_type) { case CQL_RESULT_ROW_TYPE_CUSTOM: proto_tree_add_item(columns_subtree, hf_cql_custom, tvb, offset, bytes_length, ENC_UTF_8 | ENC_NA); @@ -819,6 +824,7 @@ static int parse_value(proto_tree* columns_subtree, packet_info *pinfo, tvbuff_t item = proto_tree_add_item_ret_int(columns_subtree, hf_cql_string_result_rows_list_size, tvb, offset, 4, ENC_BIG_ENDIAN, &list_size); if (list_size < 0) { expert_add_info(pinfo, item, &ei_cql_unexpected_negative_value); + decrement_dissection_depth(pinfo); return tvb_reported_length(tvb); } offset += 4; @@ -835,6 +841,7 @@ static int parse_value(proto_tree* columns_subtree, packet_info *pinfo, tvbuff_t proto_item_append_text(map_subtree, " with %" PRId32 " element(s)", map_size); if (map_size < 0) { expert_add_info(pinfo, item, &ei_cql_unexpected_negative_value); + decrement_dissection_depth(pinfo); return tvb_reported_length(tvb); } else if (map_size == 0) { *offset_metadata += 4; /* skip the type fields of *both* key and value in the map in the metadata */ @@ -853,6 +860,7 @@ static int parse_value(proto_tree* columns_subtree, packet_info *pinfo, tvbuff_t offset += 4; if (set_size < 0) { expert_add_info(pinfo, item, &ei_cql_unexpected_negative_value); + decrement_dissection_depth(pinfo); return tvb_reported_length(tvb); } else if (set_size == 0) { *offset_metadata += 2; /* skip the type field of the elements in the set in the metadata */ @@ -910,6 +918,7 @@ static int parse_value(proto_tree* columns_subtree, packet_info *pinfo, tvbuff_t default: break; } + decrement_dissection_depth(pinfo); return offset; } @@ -1474,7 +1483,7 @@ dissect_cql_tcp_pdu(tvbuff_t* raw_tvb, packet_info* pinfo, proto_tree* tree, voi /* type "option" */ - offset = parse_option(col_spec_subtree, tvb, offset); + offset = parse_option(col_spec_subtree, pinfo, tvb, offset); } } |