summaryrefslogtreecommitdiffstats
path: root/epan/dissectors
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-26 17:44:17 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-26 17:44:17 +0000
commit2d78050fd56b8188aa5a65ad2667e301b60eea45 (patch)
treeb54d4adac6de0a196b8bb8a67b34fe186c21378f /epan/dissectors
parentAdding upstream version 4.2.2. (diff)
downloadwireshark-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 '')
-rw-r--r--epan/dissectors/asn1/kerberos/packet-kerberos-template.c2
-rw-r--r--epan/dissectors/asn1/mpeg-pes/packet-mpeg-pes-template.c3
-rw-r--r--epan/dissectors/asn1/snmp/packet-snmp-template.c10
-rw-r--r--epan/dissectors/asn1/t38/packet-t38-template.c5
-rw-r--r--epan/dissectors/asn1/tcap/packet-tcap-template.c3
-rw-r--r--epan/dissectors/file-blf.c5
-rw-r--r--epan/dissectors/file-jpeg.c4
-rw-r--r--epan/dissectors/file-rbm.c20
-rw-r--r--epan/dissectors/packet-6lowpan.c8
-rw-r--r--epan/dissectors/packet-afp.c8
-rw-r--r--epan/dissectors/packet-alljoyn.c27
-rw-r--r--epan/dissectors/packet-amqp.c19
-rw-r--r--epan/dissectors/packet-asam-cmp.c9
-rw-r--r--epan/dissectors/packet-asap.c99
-rw-r--r--epan/dissectors/packet-babel.c3
-rw-r--r--epan/dissectors/packet-bacnet.c6
-rw-r--r--epan/dissectors/packet-banana.c3
-rw-r--r--epan/dissectors/packet-beep.c7
-rw-r--r--epan/dissectors/packet-bencode.c17
-rw-r--r--epan/dissectors/packet-bfcp.c6
-rw-r--r--epan/dissectors/packet-bgp.c9
-rw-r--r--epan/dissectors/packet-bt-dht.c4
-rw-r--r--epan/dissectors/packet-btbnep.c3
-rw-r--r--epan/dissectors/packet-btsdp.c3
-rw-r--r--epan/dissectors/packet-bvlc.c6
-rw-r--r--epan/dissectors/packet-cip.c7
-rw-r--r--epan/dissectors/packet-cmip.c12
-rw-r--r--epan/dissectors/packet-cmp.c12
-rw-r--r--epan/dissectors/packet-corosync-totemsrp.c4
-rw-r--r--epan/dissectors/packet-cose.c6
-rw-r--r--epan/dissectors/packet-cql.c25
-rw-r--r--epan/dissectors/packet-csn1.c15
-rw-r--r--epan/dissectors/packet-dap.c45
-rw-r--r--epan/dissectors/packet-dccp.c5
-rw-r--r--epan/dissectors/packet-dcm.c63
-rw-r--r--epan/dissectors/packet-dcm.h4
-rw-r--r--epan/dissectors/packet-dcom.c3
-rw-r--r--epan/dissectors/packet-dhcpv6.c8
-rw-r--r--epan/dissectors/packet-disp.c23
-rw-r--r--epan/dissectors/packet-docsis-macmgmt.c2
-rw-r--r--epan/dissectors/packet-dof.c71
-rw-r--r--epan/dissectors/packet-dvb-s2-bb.c2
-rw-r--r--epan/dissectors/packet-e2ap.c34
-rw-r--r--epan/dissectors/packet-edonkey.c6
-rw-r--r--epan/dissectors/packet-enrp.c53
-rw-r--r--epan/dissectors/packet-erldp.c7
-rw-r--r--epan/dissectors/packet-etch.c42
-rw-r--r--epan/dissectors/packet-extrememesh.c2
-rw-r--r--epan/dissectors/packet-fcswils.c2
-rw-r--r--epan/dissectors/packet-geonw.c5
-rw-r--r--epan/dissectors/packet-giop.c28
-rw-r--r--epan/dissectors/packet-glow.c34
-rw-r--r--epan/dissectors/packet-goose.c12
-rw-r--r--epan/dissectors/packet-gquic.c2
-rw-r--r--epan/dissectors/packet-gsm_abis_oml.c6
-rw-r--r--epan/dissectors/packet-gsm_gsup.c3
-rw-r--r--epan/dissectors/packet-gtp.c21
-rw-r--r--epan/dissectors/packet-gtpv2.c18
-rw-r--r--epan/dissectors/packet-h223.c12
-rw-r--r--epan/dissectors/packet-h225.c23
-rw-r--r--epan/dissectors/packet-h245.c78
-rw-r--r--epan/dissectors/packet-h248.c12
-rw-r--r--epan/dissectors/packet-h264.c26
-rw-r--r--epan/dissectors/packet-h265.c21
-rw-r--r--epan/dissectors/packet-hsms.c9
-rw-r--r--epan/dissectors/packet-http2.c76
-rw-r--r--epan/dissectors/packet-icmpv6.c5
-rw-r--r--epan/dissectors/packet-icq.c4
-rw-r--r--epan/dissectors/packet-ieee1609dot2.c12
-rw-r--r--epan/dissectors/packet-ieee1722.c2
-rw-r--r--epan/dissectors/packet-ip.c4
-rw-r--r--epan/dissectors/packet-ipp.c31
-rw-r--r--epan/dissectors/packet-ippusb.c12
-rw-r--r--epan/dissectors/packet-ipv6.c4
-rw-r--r--epan/dissectors/packet-isakmp.c11
-rw-r--r--epan/dissectors/packet-iscsi.c3
-rw-r--r--epan/dissectors/packet-isis-lsp.c11
-rw-r--r--epan/dissectors/packet-iso15765.c11
-rw-r--r--epan/dissectors/packet-iso7816.c20
-rw-r--r--epan/dissectors/packet-isup.c14
-rw-r--r--epan/dissectors/packet-its.c12
-rw-r--r--epan/dissectors/packet-json_3gpp.c3
-rw-r--r--epan/dissectors/packet-jxta.c11
-rw-r--r--epan/dissectors/packet-kafka.c12
-rw-r--r--epan/dissectors/packet-kerberos.c2
-rw-r--r--epan/dissectors/packet-kink.c12
-rw-r--r--epan/dissectors/packet-knxip.c5
-rw-r--r--epan/dissectors/packet-ldap.c12
-rw-r--r--epan/dissectors/packet-ldp.c7
-rw-r--r--epan/dissectors/packet-li5g.c6
-rw-r--r--epan/dissectors/packet-lisp-tcp.c2
-rw-r--r--epan/dissectors/packet-lisp.c75
-rw-r--r--epan/dissectors/packet-lisp.h2
-rw-r--r--epan/dissectors/packet-llrp.c9
-rw-r--r--epan/dissectors/packet-lwm2mtlv.c11
-rw-r--r--epan/dissectors/packet-m2ua.c7
-rw-r--r--epan/dissectors/packet-m3ua.c12
-rw-r--r--epan/dissectors/packet-mac-lte.c26
-rw-r--r--epan/dissectors/packet-mbim.c5
-rw-r--r--epan/dissectors/packet-mms.c45
-rw-r--r--epan/dissectors/packet-mongo.c9
-rw-r--r--epan/dissectors/packet-mpeg-pes.c3
-rw-r--r--epan/dissectors/packet-mpls-echo.c4
-rw-r--r--epan/dissectors/packet-mq-pcf.c5
-rw-r--r--epan/dissectors/packet-mqtt-sn.c3
-rw-r--r--epan/dissectors/packet-msdp.c4
-rw-r--r--epan/dissectors/packet-msgpack.c8
-rw-r--r--epan/dissectors/packet-mswsp.c8
-rw-r--r--epan/dissectors/packet-nas_5gs.c3
-rw-r--r--epan/dissectors/packet-nbt.c35
-rw-r--r--epan/dissectors/packet-netflow.c7
-rw-r--r--epan/dissectors/packet-netlink.c7
-rw-r--r--epan/dissectors/packet-nhrp.c4
-rw-r--r--epan/dissectors/packet-ntlmssp.c2
-rw-r--r--epan/dissectors/packet-openflow_v4.c2
-rw-r--r--epan/dissectors/packet-openflow_v5.c4
-rw-r--r--epan/dissectors/packet-openflow_v6.c5
-rw-r--r--epan/dissectors/packet-opensafety.c2
-rw-r--r--epan/dissectors/packet-openwire.c8
-rw-r--r--epan/dissectors/packet-opsi.c17
-rw-r--r--epan/dissectors/packet-osc.c9
-rw-r--r--epan/dissectors/packet-p22.c45
-rw-r--r--epan/dissectors/packet-p7.c12
-rw-r--r--epan/dissectors/packet-pana.c7
-rw-r--r--epan/dissectors/packet-parlay.c15
-rw-r--r--epan/dissectors/packet-pim.c5
-rw-r--r--epan/dissectors/packet-protobuf.c20
-rw-r--r--epan/dissectors/packet-proxy.c3
-rw-r--r--epan/dissectors/packet-q2931.c6
-rw-r--r--epan/dissectors/packet-qnet6.c7
-rw-r--r--epan/dissectors/packet-rdp.c4
-rw-r--r--epan/dissectors/packet-resp.c5
-rw-r--r--epan/dissectors/packet-rpl.c4
-rw-r--r--epan/dissectors/packet-rsl.c4
-rw-r--r--epan/dissectors/packet-rsvp.c6
-rw-r--r--epan/dissectors/packet-rtls.c3
-rw-r--r--epan/dissectors/packet-rtmpt.c59
-rw-r--r--epan/dissectors/packet-rtp.c13
-rw-r--r--epan/dissectors/packet-rtps.c61
-rw-r--r--epan/dissectors/packet-s7comm.c10
-rw-r--r--epan/dissectors/packet-scsi.c3
-rw-r--r--epan/dissectors/packet-sctp.c36
-rw-r--r--epan/dissectors/packet-simulcrypt.c6
-rw-r--r--epan/dissectors/packet-sll.h1
-rw-r--r--epan/dissectors/packet-slsk.c282
-rw-r--r--epan/dissectors/packet-smb2.c17
-rw-r--r--epan/dissectors/packet-sml.c5
-rw-r--r--epan/dissectors/packet-sna.c7
-rw-r--r--epan/dissectors/packet-snmp.c10
-rw-r--r--epan/dissectors/packet-snort-config.c2
-rw-r--r--epan/dissectors/packet-socketcan.c413
-rw-r--r--epan/dissectors/packet-socketcan.h46
-rw-r--r--epan/dissectors/packet-socks.c6
-rw-r--r--epan/dissectors/packet-solaredge.c12
-rw-r--r--epan/dissectors/packet-someip.c34
-rw-r--r--epan/dissectors/packet-sua.c19
-rw-r--r--epan/dissectors/packet-t38.c5
-rw-r--r--epan/dissectors/packet-tcap.c3
-rw-r--r--epan/dissectors/packet-tcp.c6
-rw-r--r--epan/dissectors/packet-teap.c8
-rw-r--r--epan/dissectors/packet-tecmp.c2
-rw-r--r--epan/dissectors/packet-tftp.c17
-rw-r--r--epan/dissectors/packet-thread.c3
-rw-r--r--epan/dissectors/packet-thrift.c107
-rw-r--r--epan/dissectors/packet-tls-utils.c8
-rw-r--r--epan/dissectors/packet-tn5250.c3
-rw-r--r--epan/dissectors/packet-usb-hid.c3
-rw-r--r--epan/dissectors/packet-usb-video.c3
-rw-r--r--epan/dissectors/packet-vp9.c2
-rw-r--r--epan/dissectors/packet-wassp.c3
-rw-r--r--epan/dissectors/packet-windows-common.c16
-rw-r--r--epan/dissectors/packet-wlccp.c2
-rw-r--r--epan/dissectors/packet-wow.c26
-rw-r--r--epan/dissectors/packet-wtp.c2
-rw-r--r--epan/dissectors/packet-x11.c28
-rw-r--r--epan/dissectors/packet-x509if.c34
-rw-r--r--epan/dissectors/packet-x509sat.c12
-rw-r--r--epan/dissectors/packet-x75.c2
-rw-r--r--epan/dissectors/packet-xml.c6
-rw-r--r--epan/dissectors/packet-xmpp-utils.c32
-rw-r--r--epan/dissectors/packet-xmpp-utils.h2
-rw-r--r--epan/dissectors/packet-xmpp.c2
-rw-r--r--epan/dissectors/packet-yami.c3
-rw-r--r--epan/dissectors/packet-z3950.c34
-rw-r--r--epan/dissectors/packet-zbee-nwk-gp.c14
-rw-r--r--epan/dissectors/packet-zbee-zcl.c4
-rw-r--r--epan/dissectors/usb.c117
187 files changed, 2341 insertions, 1053 deletions
diff --git a/epan/dissectors/asn1/kerberos/packet-kerberos-template.c b/epan/dissectors/asn1/kerberos/packet-kerberos-template.c
index 49646377..2b5a906d 100644
--- a/epan/dissectors/asn1/kerberos/packet-kerberos-template.c
+++ b/epan/dissectors/asn1/kerberos/packet-kerberos-template.c
@@ -2074,7 +2074,7 @@ verify_krb5_pac_ticket_checksum(proto_tree *tree _U_,
}
checksum.length = MIN(checksum.length, (unsigned int)checksum_length);
- tepdata.data = (void *)(uintptr_t)tepbuffer;
+ tepdata.data = (void *)tepbuffer;
tepdata.length = teplength;
ret = decode_krb5_enc_tkt_part(&tepdata, &tep);
diff --git a/epan/dissectors/asn1/mpeg-pes/packet-mpeg-pes-template.c b/epan/dissectors/asn1/mpeg-pes/packet-mpeg-pes-template.c
index c4e8990d..680fa910 100644
--- a/epan/dissectors/asn1/mpeg-pes/packet-mpeg-pes-template.c
+++ b/epan/dissectors/asn1/mpeg-pes/packet-mpeg-pes-template.c
@@ -399,6 +399,7 @@ static int
dissect_mpeg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data);
static gboolean
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
int prefix;
@@ -434,6 +435,7 @@ dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
offset = dissect_mpeg_pes_PES(tvb, offset, &asn1_ctx,
tree, proto_mpeg_pes);
+ increment_dissection_depth(pinfo);
if (stream == STREAM_PICTURE) {
int frame_type;
@@ -598,6 +600,7 @@ dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
proto_tree_add_item(tree, hf_mpeg_pes_data, tvb,
offset / 8, -1, ENC_NA);
}
+ decrement_dissection_depth(pinfo);
return TRUE;
}
diff --git a/epan/dissectors/asn1/snmp/packet-snmp-template.c b/epan/dissectors/asn1/snmp/packet-snmp-template.c
index e8e606e1..96a4a4ae 100644
--- a/epan/dissectors/asn1/snmp/packet-snmp-template.c
+++ b/epan/dissectors/asn1/snmp/packet-snmp-template.c
@@ -411,12 +411,9 @@ snmp_match_request_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
{
proto_item *it;
- // if it is a request
- if (srrp->request_frame_id == pinfo->fd->num)
+ // if it is the response
+ if (srrp->response_frame_id == pinfo->fd->num)
{
- it=proto_tree_add_uint(tree, hf_snmp_response_in, tvb, 0, 0, srrp->response_frame_id);
- proto_item_set_generated(it);
- } else {
nstime_t ns;
it=proto_tree_add_uint(tree, hf_snmp_response_to, tvb, 0, 0, srrp->request_frame_id);
proto_item_set_generated(it);
@@ -425,6 +422,9 @@ snmp_match_request_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_item_set_generated(it);
return srrp;
+ } else {
+ it=proto_tree_add_uint(tree, hf_snmp_response_in, tvb, 0, 0, srrp->response_frame_id);
+ proto_item_set_generated(it);
}
}
diff --git a/epan/dissectors/asn1/t38/packet-t38-template.c b/epan/dissectors/asn1/t38/packet-t38-template.c
index ad46a999..852885c1 100644
--- a/epan/dissectors/asn1/t38/packet-t38-template.c
+++ b/epan/dissectors/asn1/t38/packet-t38-template.c
@@ -250,6 +250,7 @@ void t38_add_address(packet_info *pinfo,
p_conversation_data->setup_frame_number = setup_frame_number;
p_conversation_data->src_t38_info.reass_ID = 0;
p_conversation_data->src_t38_info.reass_start_seqnum = -1;
+ p_conversation_data->src_t38_info.reass_start_data_field = 0;
p_conversation_data->src_t38_info.reass_data_type = 0;
p_conversation_data->src_t38_info.last_seqnum = -1;
p_conversation_data->src_t38_info.packet_lost = 0;
@@ -261,6 +262,7 @@ void t38_add_address(packet_info *pinfo,
p_conversation_data->dst_t38_info.reass_ID = 0;
p_conversation_data->dst_t38_info.reass_start_seqnum = -1;
+ p_conversation_data->dst_t38_info.reass_start_data_field = 0;
p_conversation_data->dst_t38_info.reass_data_type = 0;
p_conversation_data->dst_t38_info.last_seqnum = -1;
p_conversation_data->dst_t38_info.packet_lost = 0;
@@ -323,8 +325,9 @@ force_reassemble_seq(reassembly_table *table, packet_info *pinfo, guint32 id)
last_fd=fd_i;
}
- data = (guint8 *) wmem_alloc(pinfo->pool, size);
+ data = (guint8 *) g_malloc(size);
fd_head->tvb_data = tvb_new_real_data(data, size, size);
+ tvb_set_free_cb(fd_head->tvb_data, g_free);
fd_head->len = size; /* record size for caller */
/* add all data fragments */
diff --git a/epan/dissectors/asn1/tcap/packet-tcap-template.c b/epan/dissectors/asn1/tcap/packet-tcap-template.c
index 65efb15b..97485493 100644
--- a/epan/dissectors/asn1/tcap/packet-tcap-template.c
+++ b/epan/dissectors/asn1/tcap/packet-tcap-template.c
@@ -2114,6 +2114,7 @@ static void cleanup_tcap(void)
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_tcap_param(asn1_ctx_t *actx, proto_tree *tree, tvbuff_t *tvb, int offset)
{
gint tag_offset, saved_offset, len_offset;
@@ -2156,7 +2157,9 @@ dissect_tcap_param(asn1_ctx_t *actx, proto_tree *tree, tvbuff_t *tvb, int offset
if (len-(2*ind_field)) /*should always be positive unless we get an empty contructor pointless? */
{
next_tvb = tvb_new_subset_length(tvb, offset, len-(2*ind_field));
+ increment_dissection_depth(actx->pinfo);
dissect_tcap_param(actx, subtree,next_tvb,0);
+ decrement_dissection_depth(actx->pinfo);
}
if (ind_field)
diff --git a/epan/dissectors/file-blf.c b/epan/dissectors/file-blf.c
index 200d5de6..d527ea31 100644
--- a/epan/dissectors/file-blf.c
+++ b/epan/dissectors/file-blf.c
@@ -22,6 +22,7 @@
#include <epan/packet.h>
#include <epan/prefs.h>
+
#include <wiretap/blf.h>
static int proto_blf = -1;
@@ -395,6 +396,7 @@ dissect_blf_api_version(proto_tree *tree, int hf, tvbuff_t *tvb, gint offset, gi
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_blf_lobj(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint offset_orig) {
proto_item *ti_root = NULL;
proto_item *ti = NULL;
@@ -722,6 +724,7 @@ dissect_blf_lobj(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, gint o
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_blf_next_object(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset) {
gint offset_orig = offset;
@@ -729,7 +732,9 @@ dissect_blf_next_object(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gin
if (tvb_memeql(tvb, offset, blf_lobj_magic, MAGIC_NUMBER_SIZE) != 0) {
offset += 1;
} else {
+ increment_dissection_depth(pinfo);
int bytes_parsed = dissect_blf_lobj(tvb, pinfo, tree, offset);
+ decrement_dissection_depth(pinfo);
if (bytes_parsed <= 0) {
return 0;
} else {
diff --git a/epan/dissectors/file-jpeg.c b/epan/dissectors/file-jpeg.c
index 12a7e578..0eba3c95 100644
--- a/epan/dissectors/file-jpeg.c
+++ b/epan/dissectors/file-jpeg.c
@@ -25,6 +25,7 @@
#include "config.h"
#include <epan/packet.h>
+#include <epan/proto_data.h>
#include <epan/expert.h>
#include <wiretap/wtap.h>
@@ -770,6 +771,7 @@ process_app0_segment(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, guint3
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
process_tiff_ifd_chain(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo,
guint encoding, guint32 start_ifd_offset,
int hf_tag, const char *ifd_type_desc)
@@ -893,9 +895,11 @@ process_tiff_ifd_chain(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo,
if (extension_ifd_type_desc) {
if (extension_ifd_offset < tvb_reported_length(tvb)) {
+ increment_dissection_depth(pinfo);
process_tiff_ifd_chain(tree, tvb, pinfo, encoding,
extension_ifd_offset, extension_hf_ifd_tag,
extension_ifd_type_desc);
+ decrement_dissection_depth(pinfo);
} else {
expert_add_info_format(pinfo, value_item, &ei_start_ifd_offset,
"bogus, should be < %u", tvb_reported_length(tvb));
diff --git a/epan/dissectors/file-rbm.c b/epan/dissectors/file-rbm.c
index 988b7048..dd043d35 100644
--- a/epan/dissectors/file-rbm.c
+++ b/epan/dissectors/file-rbm.c
@@ -20,8 +20,10 @@
*/
#include "config.h"
-#include <epan/packet.h>
+
#include <epan/expert.h>
+#include <epan/packet.h>
+
#include <file-rbm.h>
#include <wiretap/ruby_marshal.h>
@@ -193,6 +195,7 @@ static void dissect_rbm_string_data(tvbuff_t* tvb, packet_info* pinfo, proto_tre
dissect_rbm_string_data_trailer(tvb, pinfo, tree, offset, label, prefix, "", value_str);
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_rbm_array(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, guint* offset, gchar** value_str)
{
gint32 value;
@@ -219,6 +222,7 @@ static void dissect_rbm_array(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tre
*value_str = wmem_strdup_printf(pinfo->pool, "%d", value);
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_rbm_hash(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, guint* offset, gchar** value_str)
{
gint32 value;
@@ -318,6 +322,7 @@ static void dissect_rbm_struct_data(tvbuff_t* tvb, packet_info* pinfo, proto_tre
*value_str = wmem_strdup_printf(pinfo->pool, "%d", value);
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_rbm_string(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, guint* offset, gchar** value)
{
dissect_rbm_string_data(tvb, pinfo, tree, offset, "String", "", value);
@@ -326,6 +331,7 @@ static void dissect_rbm_string(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tr
dissect_rbm_object(tvb, pinfo, tree, offset, NULL, NULL);
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_rbm_regex(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, guint* offset, gchar** value)
{
dissect_rbm_string_data_trailer(tvb, pinfo, tree, offset, "Regexp", "/", "/", value);
@@ -341,6 +347,7 @@ static void dissect_rbm_class(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tre
dissect_rbm_string_data(tvb, pinfo, tree, offset, "Class", "", value_str);
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_rbm_userclass(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, guint* offset, gchar** value)
{
rbm_set_info(pinfo, "UserClass");
@@ -352,6 +359,7 @@ static void dissect_rbm_symbol(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tr
dissect_rbm_string_data(tvb, pinfo, tree, offset, "Symbol", ":", value_str);
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_rbm_variable(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, guint* offset, gchar** value_str)
{
gint offset_start = *offset;
@@ -365,12 +373,14 @@ static void dissect_rbm_module(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tr
dissect_rbm_string_data(tvb, pinfo, tree, offset, "Module", "", value_str);
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_rbm_struct(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, guint* offset, gchar** value)
{
dissect_rbm_struct_data(tvb, pinfo, tree, offset, value);
dissect_rbm_hash(tvb, pinfo, tree, offset, NULL);
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_rbm_drb(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, guint* offset)
{
gint offset_start = *offset;
@@ -380,6 +390,7 @@ static void dissect_rbm_drb(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree,
proto_item_set_len(drb_tree, *offset - offset_start);
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_rbm_rubyobject(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, guint* offset)
{
gint offset_start = *offset;
@@ -397,6 +408,7 @@ static void dissect_rbm_rubyobject(tvbuff_t* tvb, packet_info* pinfo, proto_tree
proto_item_set_len(obj_tree, *offset - offset_start);
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_rbm_extended(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, guint* offset)
{
gint offset_start = *offset;
@@ -407,6 +419,7 @@ static void dissect_rbm_extended(tvbuff_t* tvb, packet_info* pinfo, proto_tree*
proto_item_set_len(ext_tree, *offset - offset_start);
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_rbm_object(tvbuff_t* tvb, packet_info* pinfo, proto_tree* ptree, guint* offset, gchar** type, gchar** value)
{
guint8 subtype = tvb_get_guint8(tvb, *offset);
@@ -420,6 +433,8 @@ static void dissect_rbm_object(tvbuff_t* tvb, packet_info* pinfo, proto_tree* pt
proto_tree_add_item(tree, hf_rbm_type, tvb, *offset, 1, ENC_NA);
*offset += 1;
+ increment_dissection_depth(pinfo);
+
switch (subtype) {
case '0':
case 'T':
@@ -509,6 +524,8 @@ static void dissect_rbm_object(tvbuff_t* tvb, packet_info* pinfo, proto_tree* pt
*type = type_local;
if (value)
*value = value_local;
+
+ decrement_dissection_depth(pinfo);
}
static gboolean dissect_rbm_header(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, guint* offset)
@@ -532,6 +549,7 @@ static gboolean dissect_rbm_header(tvbuff_t* tvb, packet_info* pinfo, proto_tree
return TRUE;
}
+// NOLINTNEXTLINE(misc-no-recursion)
void dissect_rbm_inline(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, guint* offset, gchar** type, gchar** value)
{
if (!dissect_rbm_header(tvb, pinfo, tree, offset))
diff --git a/epan/dissectors/packet-6lowpan.c b/epan/dissectors/packet-6lowpan.c
index 068b9a6e..b13cd08d 100644
--- a/epan/dissectors/packet-6lowpan.c
+++ b/epan/dissectors/packet-6lowpan.c
@@ -238,6 +238,7 @@ void proto_reg_handoff_6lowpan(void);
/* 6LoWPAN interface identifier length. */
#define LOWPAN_IFC_ID_LEN 8
+
/* Protocol fields handles. */
static int proto_6lowpan = -1;
static int hf_6lowpan_pattern = -1;
@@ -1858,6 +1859,7 @@ dissect_6lowpan_hc1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint dg
*---------------------------------------------------------------
*/
static tvbuff_t *
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint dgram_size, const guint8 *siid, const guint8 *diid)
{
ieee802154_hints_t *hints;
@@ -2296,6 +2298,7 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d
*---------------------------------------------------------------
*/
static struct lowpan_nhdr *
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, gint dgram_size, const guint8 *siid, const guint8 *diid)
{
gint length;
@@ -2326,7 +2329,10 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi
offset += 1;
/* Decode the remainder of the packet using IPHC encoding. */
+ increment_dissection_depth(pinfo);
iphc_tvb = dissect_6lowpan_iphc(tvb_new_subset_remaining(tvb, offset), pinfo, tree, dgram_size, siid, diid);
+ decrement_dissection_depth(pinfo);
+
if (!iphc_tvb) return NULL;
/* Create the next header structure for the tunneled IPv6 header. */
@@ -2457,7 +2463,9 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi
* There are more LOWPAN_NHC structures to parse. Call ourself again
* recursively to parse them and build the linked list.
*/
+ increment_dissection_depth(pinfo);
nhdr->next = dissect_6lowpan_iphc_nhc(tvb, pinfo, tree, offset, dgram_size - nhdr->reported, siid, diid);
+ decrement_dissection_depth(pinfo);
}
else if (ipv6_ext.ip6e_nxt != IP_PROTO_NONE) {
/* Create another next header structure for the remaining payload. */
diff --git a/epan/dissectors/packet-afp.c b/epan/dissectors/packet-afp.c
index a17fc57b..f6229da3 100644
--- a/epan/dissectors/packet-afp.c
+++ b/epan/dissectors/packet-afp.c
@@ -19,6 +19,7 @@
#include <epan/exceptions.h>
#include <epan/to_str.h>
#include <epan/conversation.h>
+#include <epan/prefs.h>
#include <epan/tap.h>
#include <epan/srt_table.h>
#include <epan/expert.h>
@@ -4219,6 +4220,7 @@ static const val64_string cpx_qtype_string_values[] = {
};
static gint
+// NOLINTNEXTLINE(misc-no-recursion)
spotlight_dissect_query_loop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset,
guint64 cpx_query_type, gint count, gint toc_offset, guint encoding)
{
@@ -4240,8 +4242,8 @@ spotlight_dissect_query_loop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
/*
* This loops through a possibly nested query data structure.
* The outermost one is always without count and called from
- * dissect_spotlight() with count = INT_MAX thus the while (...)
- * loop terminates if (offset >= toc_offset).
+ * dissect_spotlight() with count = prefs.gui_max_tree_depth
+ * thus the while (...) loop terminates if (offset >= toc_offset).
* If nested structures are found, these will have an encoded element
* count which is used in a recursive call to
* spotlight_dissect_query_loop as count parameter, thus in this case
@@ -4495,7 +4497,7 @@ dissect_spotlight(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dat
"Spotlight RPC data");
/* Queries */
- offset = spotlight_dissect_query_loop(tvb, pinfo, sub_tree_queries, offset, SQ_CPX_TYPE_ARRAY, INT_MAX, offset + (gint)toc_offset + 8, encoding);
+ offset = spotlight_dissect_query_loop(tvb, pinfo, sub_tree_queries, offset, SQ_CPX_TYPE_ARRAY, prefs.gui_max_tree_depth, offset + (gint)toc_offset + 8, encoding);
/* ToC */
sub_tree_toc = proto_tree_add_subtree_format(tree, tvb, offset,
diff --git a/epan/dissectors/packet-alljoyn.c b/epan/dissectors/packet-alljoyn.c
index 8dee1bff..a122bc89 100644
--- a/epan/dissectors/packet-alljoyn.c
+++ b/epan/dissectors/packet-alljoyn.c
@@ -769,13 +769,15 @@ append_struct_signature(proto_item *item,
* @param signature_length is a pointer to the length of the signature.
*/
static void
-advance_to_end_of_signature(const guint8 **signature,
- guint8 *signature_length)
+// NOLINTNEXTLINE(misc-no-recursion)
+advance_to_end_of_signature(packet_info *pinfo, const guint8 **signature, guint8 *signature_length)
{
gboolean done = FALSE;
gint8 current_type;
gint8 end_type = ARG_INVALID;
+ increment_dissection_depth(pinfo);
+
while (*signature_length > 0 && **signature && !done) {
current_type = *(++(*signature));
--*signature_length;
@@ -792,15 +794,15 @@ advance_to_end_of_signature(const guint8 **signature,
switch(current_type)
{
case ARG_ARRAY:
- advance_to_end_of_signature(signature, signature_length);
+ advance_to_end_of_signature(pinfo, signature, signature_length);
break;
case ARG_STRUCT:
end_type = ')';
- advance_to_end_of_signature(signature, signature_length);
+ advance_to_end_of_signature(pinfo, signature, signature_length);
break;
case ARG_DICT_ENTRY:
end_type = '}';
- advance_to_end_of_signature(signature, signature_length);
+ advance_to_end_of_signature(pinfo, signature, signature_length);
break;
case ARG_BYTE:
@@ -825,6 +827,7 @@ advance_to_end_of_signature(const guint8 **signature,
break;
}
}
+ decrement_dissection_depth(pinfo);
}
/* This is called to add a padding item. There is not padding done for each call made.
@@ -877,6 +880,7 @@ static void add_padding_item(gint padding_start, gint padding_end, tvbuff_t *tvb
* parameters come in.
*/
static gint
+// NOLINTNEXTLINE(misc-no-recursion)
parse_arg(tvbuff_t *tvb,
packet_info *pinfo,
proto_item *header_item,
@@ -941,10 +945,12 @@ parse_arg(tvbuff_t *tvb,
add_padding_item(padding_start, offset, tvb, tree);
if(0 == length) {
- advance_to_end_of_signature(signature, signature_length);
+ advance_to_end_of_signature(pinfo, signature, signature_length);
} else {
guint8 sig_length_saved = *signature_length - 1;
+ increment_dissection_depth(pinfo);
+
while((offset - starting_offset) < length) {
const guint8 *sig_pointer;
guint8 remaining_sig_length;
@@ -970,6 +976,7 @@ parse_arg(tvbuff_t *tvb,
*signature = sig_pointer;
*signature_length = remaining_sig_length;
}
+ decrement_dissection_depth(pinfo);
}
if(item) {
@@ -1180,14 +1187,18 @@ parse_arg(tvbuff_t *tvb,
offset += length;
sig_pointer = sig_saved;
+ increment_dissection_depth(pinfo);
+
/* The signature of the variant has now been taken care of. So now take care of the variant data. */
while(((sig_pointer - sig_saved) < (length - 1)) && (tvb_reported_length_remaining(tvb, offset) > 0)) {
proto_item_append_text(item, "%c", g_ascii_isprint(*sig_pointer) ? *sig_pointer : '?');
offset = parse_arg(tvb, pinfo, header_item, encoding, offset, tree, is_reply_to,
*sig_pointer, field_code, &sig_pointer, &variant_sig_length, field_starting_offset);
+
}
+ decrement_dissection_depth(pinfo);
proto_item_append_text(item, "'");
proto_item_set_end(item, tvb, offset);
}
@@ -1241,6 +1252,8 @@ parse_arg(tvbuff_t *tvb,
(*signature)++; /* Advance past the '(' or '{'. */
(*signature_length)--;
+ increment_dissection_depth(pinfo);
+
/* *signature should never be NULL but just make sure to avoid potential issues. */
while(*signature && **signature && **signature != type_stop
&& tvb_reported_length_remaining(tvb, offset) > 0) {
@@ -1258,6 +1271,8 @@ parse_arg(tvbuff_t *tvb,
field_starting_offset);
}
+ decrement_dissection_depth(pinfo);
+
proto_item_set_end(item, tvb, offset);
}
break;
diff --git a/epan/dissectors/packet-amqp.c b/epan/dissectors/packet-amqp.c
index 69b85075..65cf1dfb 100644
--- a/epan/dissectors/packet-amqp.c
+++ b/epan/dissectors/packet-amqp.c
@@ -2394,6 +2394,7 @@ get_amqp_0_9_message_len(packet_info *pinfo _U_, tvbuff_t *tvb,
/* Dissection routine for AMQP 0-9 field tables */
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_amqp_0_9_field_table(tvbuff_t *tvb, packet_info *pinfo, int offset, guint length, proto_item *item)
{
proto_tree *field_table_tree, *field_item_tree;
@@ -2419,7 +2420,9 @@ dissect_amqp_0_9_field_table(tvbuff_t *tvb, packet_info *pinfo, int offset, guin
offset += namelen;
length -= namelen;
+ increment_dissection_depth(pinfo);
vallen = dissect_amqp_0_9_field_value(tvb, pinfo, offset, length, name, field_item_tree);
+ decrement_dissection_depth(pinfo);
if(vallen == 0)
goto too_short;
offset += vallen;
@@ -2435,6 +2438,7 @@ too_short:
/* Dissection routine for AMQP 0-9 field arrays */
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_amqp_0_9_field_array(tvbuff_t *tvb, packet_info *pinfo, int offset, guint length, proto_item *item)
{
proto_tree *field_table_tree, *field_item_tree;
@@ -2453,7 +2457,9 @@ dissect_amqp_0_9_field_array(tvbuff_t *tvb, packet_info *pinfo, int offset, guin
field_item_tree = proto_item_add_subtree(field_item, ett_amqp_0_9_field);
name = wmem_strdup_printf(pinfo->pool, "[%i]", idx);
+ increment_dissection_depth(pinfo);
vallen = dissect_amqp_0_9_field_value(tvb, pinfo, offset, length, name, field_item_tree);
+ decrement_dissection_depth(pinfo);
if(vallen == 0)
goto too_short;
offset += vallen;
@@ -2523,6 +2529,7 @@ static const value_string amqp_0_9_field_type_vals[] = {
};
static guint
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_amqp_0_9_field_value(tvbuff_t *tvb, packet_info *pinfo, int offset, guint length,
const char *name _U_, proto_tree *field_tree)
{
@@ -2818,6 +2825,7 @@ dissect_amqp_0_10_map(tvbuff_t *tvb, proto_item *item)
/* Dissection routine for AMQP 0-10 maps */
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_amqp_0_10_array(tvbuff_t *tvb,
packet_info *pinfo,
int offset, /* Start of array in tvb */
@@ -5811,6 +5819,7 @@ dissect_amqp_0_10_struct_stream_properties(tvbuff_t *tvb,
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_amqp_0_10_struct32(tvbuff_t *tvb,
packet_info *pinfo,
proto_item *ti)
@@ -5827,6 +5836,8 @@ dissect_amqp_0_10_struct32(tvbuff_t *tvb,
proto_tree_add_item_ret_uint(tree, hf_amqp_0_10_struct32_class, tvb, offset, 1, ENC_NA, &class_code);
proto_tree_add_item_ret_uint(tree, hf_amqp_0_10_struct32_struct, tvb, offset+1, 1, ENC_NA, &struct_code);
+ increment_dissection_depth(pinfo);
+
switch(class_code) {
case AMQP_0_10_CLASS_MESSAGE:
switch (struct_code) {
@@ -5956,6 +5967,7 @@ dissect_amqp_0_10_struct32(tvbuff_t *tvb,
}
break;
}
+ decrement_dissection_depth(pinfo);
}
/* decodes AMQP 1.0 list
@@ -5971,6 +5983,7 @@ dissect_amqp_0_10_struct32(tvbuff_t *tvb,
* name: what to show for unformatted content
*/
static guint
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_amqp_1_0_list(tvbuff_t *tvb,
packet_info *pinfo,
int offset,
@@ -6081,6 +6094,7 @@ dissect_amqp_1_0_list(tvbuff_t *tvb,
* arguments: see dissect_amqp_1_0_list
*/
static guint
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_amqp_1_0_map(tvbuff_t *tvb,
packet_info *pinfo,
int offset,
@@ -6214,6 +6228,7 @@ dissect_amqp_1_0_map(tvbuff_t *tvb,
* arguments: see dissect_amqp_1_0_list
*/
static guint
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_amqp_1_0_array(tvbuff_t *tvb,
packet_info *pinfo,
int offset,
@@ -10009,6 +10024,7 @@ static const struct amqp1_typeinfo* decode_fixed_type(guint8 code)
* length_size: decoded length
*/
static void
+// NOLINTNEXTLINE(misc-no-recursion)
get_amqp_1_0_value_formatter(tvbuff_t *tvb,
packet_info *pinfo,
guint8 code,
@@ -10023,6 +10039,7 @@ get_amqp_1_0_value_formatter(tvbuff_t *tvb,
const struct amqp1_typeinfo* element_type;
const char *value = NULL;
+ increment_dissection_depth(pinfo);
element_type = decode_fixed_type(code);
if (element_type)
{
@@ -10141,6 +10158,7 @@ get_amqp_1_0_value_formatter(tvbuff_t *tvb,
break;
}
}
+ decrement_dissection_depth(pinfo);
}
/* It decodes 1.0 type, including type constructor
@@ -10226,6 +10244,7 @@ get_amqp_1_0_type_formatter(tvbuff_t *tvb,
* arguments: see get_amqp_1_0_value_formatter
*/
static void
+// NOLINTNEXTLINE(misc-no-recursion)
get_amqp_1_0_type_value_formatter(tvbuff_t *tvb,
packet_info *pinfo,
int offset,
diff --git a/epan/dissectors/packet-asam-cmp.c b/epan/dissectors/packet-asam-cmp.c
index 09af5add..2d37c220 100644
--- a/epan/dissectors/packet-asam-cmp.c
+++ b/epan/dissectors/packet-asam-cmp.c
@@ -1,7 +1,7 @@
/* packet-asam-cmp.c
* ASAM Capture Module Protocol dissector.
* Copyright 2021-2023 Alicia Mediano Schikarski, Technica Engineering GmbH
- * Copyright 2021-2023 Dr. Lars Voelker, Technica Engineering GmbH
+ * Copyright 2021-2024 Dr. Lars Voelker, Technica Engineering GmbH
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
@@ -1218,7 +1218,7 @@ dissect_asam_cmp_data_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root_tr
can_id = can_id | CAN_ERR_FLAG;
}
- struct can_info can_info = { .id = can_id, .len = msg_payload_type_length, .fd = false, .bus_id = ht_interface_config_to_bus_id(interface_id) };
+ struct can_info can_info = { .id = can_id, .len = msg_payload_type_length, .fd = CAN_TYPE_CAN_CLASSIC, .bus_id = ht_interface_config_to_bus_id(interface_id) };
if (!socketcan_call_subdissectors(sub_tvb, pinfo, tree, &can_info, heuristic_first)) {
call_data_dissector(sub_tvb, pinfo, tree);
}
@@ -1326,7 +1326,7 @@ dissect_asam_cmp_data_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root_tr
can_id = can_id | CAN_ERR_FLAG;
}
- struct can_info can_info = { .id = can_id, .len = msg_payload_type_length, .fd = true, .bus_id = ht_interface_config_to_bus_id(interface_id) };
+ struct can_info can_info = { .id = can_id, .len = msg_payload_type_length, .fd = CAN_TYPE_CAN_FD, .bus_id = ht_interface_config_to_bus_id(interface_id) };
if (!socketcan_call_subdissectors(sub_tvb, pinfo, tree, &can_info, heuristic_first)) {
call_data_dissector(sub_tvb, pinfo, tree);
}
@@ -1938,7 +1938,6 @@ dissect_asam_cmp_status_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root_
offset += 2;
if ((asam_cmp_status_msg_vendor_data_length) > 0) {
- asam_cmp_status_msg_vendor_data_length += (asam_cmp_status_msg_vendor_data_length % 2); /* padding to 16bit */
proto_tree_add_item(asam_cmp_status_msg_payload_tree, hf_cmp_status_vendor_data, tvb, offset, asam_cmp_status_msg_vendor_data_length, ENC_NA);
offset += (gint)asam_cmp_status_msg_vendor_data_length;
}
@@ -2016,7 +2015,6 @@ dissect_asam_cmp_status_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root_
offset += 2;
if ((asam_cmp_status_msg_vendor_data_length) > 0) {
- asam_cmp_status_msg_vendor_data_length += (asam_cmp_status_msg_vendor_data_length % 2); /* padding to 16bit */
proto_tree_add_item(subtree, hf_cmp_iface_vendor_data, tvb, offset, asam_cmp_status_msg_vendor_data_length, ENC_NA);
offset += (gint)asam_cmp_status_msg_vendor_data_length;
}
@@ -2660,6 +2658,7 @@ proto_reg_handoff_asam_cmp(void) {
eth_handle = find_dissector("eth_maybefcs");
dissector_add_for_decode_as("ethertype", asam_cmp_handle);
+ dissector_add_for_decode_as_with_preference("udp.port", asam_cmp_handle);
lin_subdissector_table = find_dissector_table("lin.frame_id");
}
diff --git a/epan/dissectors/packet-asap.c b/epan/dissectors/packet-asap.c
index f33f4eed..1b83af7e 100644
--- a/epan/dissectors/packet-asap.c
+++ b/epan/dissectors/packet-asap.c
@@ -93,9 +93,9 @@ static guint64 asap_total_msgs = 0;
static guint64 asap_total_bytes = 0;
static void
-dissect_parameters(tvbuff_t *, proto_tree *);
+dissect_parameters(tvbuff_t *, packet_info *, proto_tree *);
static void
-dissect_parameter(tvbuff_t *, proto_tree *);
+dissect_parameter(tvbuff_t *, packet_info *, proto_tree *);
static int
dissect_asap(tvbuff_t *, packet_info *, proto_tree *, void *);
@@ -125,13 +125,16 @@ dissect_unknown_cause(tvbuff_t *cause_tvb, proto_tree *cause_tree, proto_item *c
}
static void
-dissect_error_cause(tvbuff_t *cause_tvb, proto_tree *parameter_tree)
+// NOLINTNEXTLINE(misc-no-recursion)
+dissect_error_cause(tvbuff_t *cause_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
guint16 code, length, padding_length;
proto_item *cause_item;
proto_tree *cause_tree;
tvbuff_t *parameter_tvb, *message_tvb;
+ pinfo->flags.in_error_pkt = true;
+
code = tvb_get_ntohs(cause_tvb, CAUSE_CODE_OFFSET);
length = tvb_get_ntohs(cause_tvb, CAUSE_LENGTH_OFFSET);
padding_length = tvb_reported_length(cause_tvb) - length;
@@ -145,27 +148,27 @@ dissect_error_cause(tvbuff_t *cause_tvb, proto_tree *parameter_tree)
switch(code) {
case UNRECOGNIZED_PARAMETER_CAUSE_CODE:
parameter_tvb = tvb_new_subset_remaining(cause_tvb, CAUSE_INFO_OFFSET);
- dissect_parameter(parameter_tvb, cause_tree);
+ dissect_parameter(parameter_tvb, pinfo, cause_tree);
break;
case UNRECONGNIZED_MESSAGE_CAUSE_CODE:
message_tvb = tvb_new_subset_remaining(cause_tvb, CAUSE_INFO_OFFSET);
- dissect_asap(message_tvb, NULL, cause_tree, NULL);
+ dissect_asap(message_tvb, pinfo, cause_tree, NULL);
break;
case INVALID_VALUES:
parameter_tvb = tvb_new_subset_remaining(cause_tvb, CAUSE_INFO_OFFSET);
- dissect_parameter(parameter_tvb, cause_tree);
+ dissect_parameter(parameter_tvb, pinfo, cause_tree);
break;
case NON_UNIQUE_PE_IDENTIFIER:
break;
case POOLING_POLICY_INCONSISTENT_CAUSE_CODE:
parameter_tvb = tvb_new_subset_remaining(cause_tvb, CAUSE_INFO_OFFSET);
- dissect_parameter(parameter_tvb, cause_tree);
+ dissect_parameter(parameter_tvb, pinfo, cause_tree);
break;
case LACK_OF_RESOURCES_CAUSE_CODE:
break;
case INCONSISTENT_TRANSPORT_TYPE_CAUSE_CODE:
parameter_tvb = tvb_new_subset_remaining(cause_tvb, CAUSE_INFO_OFFSET);
- dissect_parameter(parameter_tvb, cause_tree);
+ dissect_parameter(parameter_tvb, pinfo, cause_tree);
break;
case INCONSISTENT_DATA_CONTROL_CONFIGURATION_CAUSE_CODE:
break;
@@ -182,7 +185,8 @@ dissect_error_cause(tvbuff_t *cause_tvb, proto_tree *parameter_tree)
}
static void
-dissect_error_causes(tvbuff_t *error_causes_tvb, proto_tree *parameter_tree)
+// NOLINTNEXTLINE(misc-no-recursion)
+dissect_error_causes(tvbuff_t *error_causes_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
guint16 length, total_length;
gint offset;
@@ -193,7 +197,7 @@ dissect_error_causes(tvbuff_t *error_causes_tvb, proto_tree *parameter_tree)
length = tvb_get_ntohs(error_causes_tvb, offset + CAUSE_LENGTH_OFFSET);
total_length = WS_ROUNDUP_4(length);
error_cause_tvb = tvb_new_subset_length(error_causes_tvb, offset , total_length);
- dissect_error_cause(error_cause_tvb, parameter_tree);
+ dissect_error_cause(error_cause_tvb, pinfo, parameter_tree);
offset += total_length;
}
}
@@ -215,7 +219,8 @@ dissect_ipv6_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, prot
}
static void
-dissect_dccp_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree)
+// NOLINTNEXTLINE(misc-no-recursion)
+dissect_dccp_transport_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@@ -224,11 +229,12 @@ dissect_dccp_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_
proto_tree_add_item(parameter_tree, hf_dccp_service_code, parameter_tvb, DCCP_SERVICE_CODE_OFFSET, DCCP_SERVICE_CODE_LENGTH, ENC_BIG_ENDIAN);
parameters_tvb = tvb_new_subset_remaining(parameter_tvb, DCCP_ADDRESS_OFFSET);
- dissect_parameters(parameters_tvb, parameter_tree);
+ dissect_parameters(parameters_tvb, pinfo, parameter_tree);
}
static void
-dissect_sctp_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree)
+// NOLINTNEXTLINE(misc-no-recursion)
+dissect_sctp_transport_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@@ -236,11 +242,12 @@ dissect_sctp_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_
proto_tree_add_item(parameter_tree, hf_transport_use, parameter_tvb, SCTP_TRANSPORT_USE_OFFSET, SCTP_TRANSPORT_USE_LENGTH, ENC_BIG_ENDIAN);
parameters_tvb = tvb_new_subset_remaining(parameter_tvb, SCTP_ADDRESS_OFFSET);
- dissect_parameters(parameters_tvb, parameter_tree);
+ dissect_parameters(parameters_tvb, pinfo, parameter_tree);
}
static void
-dissect_tcp_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree)
+// NOLINTNEXTLINE(misc-no-recursion)
+dissect_tcp_transport_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@@ -248,11 +255,12 @@ dissect_tcp_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_t
proto_tree_add_item(parameter_tree, hf_transport_use, parameter_tvb, TCP_TRANSPORT_USE_OFFSET, TCP_TRANSPORT_USE_LENGTH, ENC_BIG_ENDIAN);
parameters_tvb = tvb_new_subset_remaining(parameter_tvb, TCP_ADDRESS_OFFSET);
- dissect_parameters(parameters_tvb, parameter_tree);
+ dissect_parameters(parameters_tvb, pinfo, parameter_tree);
}
static void
-dissect_udp_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree)
+// NOLINTNEXTLINE(misc-no-recursion)
+dissect_udp_transport_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@@ -260,11 +268,12 @@ dissect_udp_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_t
proto_tree_add_item(parameter_tree, hf_udp_reserved, parameter_tvb, UDP_RESERVED_OFFSET, UDP_RESERVED_LENGTH, ENC_BIG_ENDIAN);
parameters_tvb = tvb_new_subset_remaining(parameter_tvb, UDP_ADDRESS_OFFSET);
- dissect_parameters(parameters_tvb, parameter_tree);
+ dissect_parameters(parameters_tvb, pinfo, parameter_tree);
}
static void
-dissect_udp_lite_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree)
+// NOLINTNEXTLINE(misc-no-recursion)
+dissect_udp_lite_transport_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@@ -272,7 +281,7 @@ dissect_udp_lite_transport_parameter(tvbuff_t *parameter_tvb, proto_tree *parame
proto_tree_add_item(parameter_tree, hf_udp_lite_reserved, parameter_tvb, UDP_LITE_RESERVED_OFFSET, UDP_LITE_RESERVED_LENGTH, ENC_BIG_ENDIAN);
parameters_tvb = tvb_new_subset_remaining(parameter_tvb, UDP_LITE_ADDRESS_OFFSET);
- dissect_parameters(parameters_tvb, parameter_tree);
+ dissect_parameters(parameters_tvb, pinfo, parameter_tree);
}
static void
@@ -348,7 +357,8 @@ dissect_pool_handle_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tre
}
static void
-dissect_pool_element_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree)
+// NOLINTNEXTLINE(misc-no-recursion)
+dissect_pool_element_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t* parameters_tvb;
@@ -357,27 +367,29 @@ dissect_pool_element_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tr
proto_tree_add_item(parameter_tree, hf_reg_life, parameter_tvb, REGISTRATION_LIFE_OFFSET, REGISTRATION_LIFE_LENGTH, ENC_BIG_ENDIAN);
parameters_tvb = tvb_new_subset_remaining(parameter_tvb, USER_TRANSPORT_PARAMETER_OFFSET);
- dissect_parameters(parameters_tvb, parameter_tree);
+ dissect_parameters(parameters_tvb, pinfo, parameter_tree);
}
static void
-dissect_server_information_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree)
+// NOLINTNEXTLINE(misc-no-recursion)
+dissect_server_information_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
proto_tree_add_item(parameter_tree, hf_server_identifier, parameter_tvb, SERVER_ID_OFFSET, SERVER_ID_LENGTH, ENC_BIG_ENDIAN);
parameters_tvb = tvb_new_subset_remaining(parameter_tvb, SERVER_TRANSPORT_OFFSET);
- dissect_parameters(parameters_tvb, parameter_tree);
+ dissect_parameters(parameters_tvb, pinfo, parameter_tree);
}
static void
-dissect_operation_error_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree)
+// NOLINTNEXTLINE(misc-no-recursion)
+dissect_operation_error_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *error_causes_tvb;
error_causes_tvb = tvb_new_subset_remaining(parameter_tvb, ERROR_CAUSES_OFFSET);
- dissect_error_causes(error_causes_tvb, parameter_tree);
+ dissect_error_causes(error_causes_tvb, pinfo, parameter_tree);
}
static void
@@ -426,7 +438,8 @@ dissect_unknown_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, p
}
static void
-dissect_parameter(tvbuff_t *parameter_tvb, proto_tree *asap_tree)
+// NOLINTNEXTLINE(misc-no-recursion)
+dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *asap_tree)
{
guint16 type, length, padding_length;
proto_item *parameter_item;
@@ -445,6 +458,7 @@ dissect_parameter(tvbuff_t *parameter_tvb, proto_tree *asap_tree)
proto_tree_add_item(parameter_tree, hf_parameter_type, parameter_tvb, PARAMETER_TYPE_OFFSET, PARAMETER_TYPE_LENGTH, ENC_BIG_ENDIAN);
proto_tree_add_item(parameter_tree, hf_parameter_length, parameter_tvb, PARAMETER_LENGTH_OFFSET, PARAMETER_LENGTH_LENGTH, ENC_BIG_ENDIAN);
+ increment_dissection_depth(pinfo);
switch(type) {
case IPV4_ADDRESS_PARAMETER_TYPE:
dissect_ipv4_parameter(parameter_tvb, parameter_tree, parameter_item);
@@ -453,19 +467,19 @@ dissect_parameter(tvbuff_t *parameter_tvb, proto_tree *asap_tree)
dissect_ipv6_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
case DCCP_TRANSPORT_PARAMETER_TYPE:
- dissect_dccp_transport_parameter(parameter_tvb, parameter_tree);
+ dissect_dccp_transport_parameter(parameter_tvb, pinfo, parameter_tree);
break;
case SCTP_TRANSPORT_PARAMETER_TYPE:
- dissect_sctp_transport_parameter(parameter_tvb, parameter_tree);
+ dissect_sctp_transport_parameter(parameter_tvb, pinfo, parameter_tree);
break;
case TCP_TRANSPORT_PARAMETER_TYPE:
- dissect_tcp_transport_parameter(parameter_tvb, parameter_tree);
+ dissect_tcp_transport_parameter(parameter_tvb, pinfo, parameter_tree);
break;
case UDP_TRANSPORT_PARAMETER_TYPE:
- dissect_udp_transport_parameter(parameter_tvb, parameter_tree);
+ dissect_udp_transport_parameter(parameter_tvb, pinfo, parameter_tree);
break;
case UDP_LITE_TRANSPORT_PARAMETER_TYPE:
- dissect_udp_lite_transport_parameter(parameter_tvb, parameter_tree);
+ dissect_udp_lite_transport_parameter(parameter_tvb, pinfo, parameter_tree);
break;
case POOL_MEMBER_SELECTION_POLICY_PARAMETER_TYPE:
dissect_pool_member_selection_policy_parameter(parameter_tvb, parameter_tree);
@@ -474,13 +488,13 @@ dissect_parameter(tvbuff_t *parameter_tvb, proto_tree *asap_tree)
dissect_pool_handle_parameter(parameter_tvb, parameter_tree);
break;
case POOL_ELEMENT_PARAMETER_TYPE:
- dissect_pool_element_parameter(parameter_tvb, parameter_tree);
+ dissect_pool_element_parameter(parameter_tvb, pinfo, parameter_tree);
break;
case SERVER_INFORMATION_PARAMETER_TYPE:
- dissect_server_information_parameter(parameter_tvb, parameter_tree);
+ dissect_server_information_parameter(parameter_tvb, pinfo, parameter_tree);
break;
case OPERATION_ERROR_PARAMETER_TYPE:
- dissect_operation_error_parameter(parameter_tvb, parameter_tree);
+ dissect_operation_error_parameter(parameter_tvb, pinfo, parameter_tree);
break;
case COOKIE_PARAMETER_TYPE:
dissect_cookie_parameter(parameter_tvb, parameter_tree, parameter_item);
@@ -498,13 +512,15 @@ dissect_parameter(tvbuff_t *parameter_tvb, proto_tree *asap_tree)
dissect_unknown_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
};
+ decrement_dissection_depth(pinfo);
if (padding_length > 0)
proto_tree_add_item(parameter_tree, hf_parameter_padding, parameter_tvb, PARAMETER_HEADER_OFFSET + length, padding_length, ENC_NA);
}
static void
-dissect_parameters(tvbuff_t *parameters_tvb, proto_tree *tree)
+// NOLINTNEXTLINE(misc-no-recursion)
+dissect_parameters(tvbuff_t *parameters_tvb, packet_info *pinfo, proto_tree *tree)
{
gint offset, length, total_length, remaining_length;
tvbuff_t *parameter_tvb;
@@ -517,7 +533,7 @@ dissect_parameters(tvbuff_t *parameters_tvb, proto_tree *tree)
total_length = MIN(total_length, remaining_length);
/* create a tvb for the parameter including the padding bytes */
parameter_tvb = tvb_new_subset_length(parameters_tvb, offset, total_length);
- dissect_parameter(parameter_tvb, tree);
+ dissect_parameter(parameter_tvb, pinfo, tree);
/* get rid of the handled parameter */
offset += total_length;
}
@@ -574,6 +590,7 @@ static const true_false_string reject_bit_value = {
};
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_asap_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *asap_tree)
{
asap_tap_rec_t *tap_rec;
@@ -584,7 +601,7 @@ dissect_asap_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *asap
type = tvb_get_guint8(message_tvb, MESSAGE_TYPE_OFFSET);
/* pinfo is NULL only if dissect_asap_message is called via dissect_error_cause */
- if (pinfo) {
+ if (!pinfo->flags.in_error_pkt) {
tap_rec = wmem_new0(pinfo->pool, asap_tap_rec_t);
tap_rec->type = type;
tap_rec->size = tvb_get_ntohs(message_tvb, MESSAGE_LENGTH_OFFSET);
@@ -611,19 +628,21 @@ dissect_asap_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *asap
} else {
parameters_tvb = tvb_new_subset_remaining(message_tvb, MESSAGE_VALUE_OFFSET);
}
- dissect_parameters(parameters_tvb, asap_tree);
+ dissect_parameters(parameters_tvb, pinfo, asap_tree);
}
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_asap(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *asap_item;
proto_tree *asap_tree;
/* pinfo is NULL only if dissect_asap is called from dissect_error_cause */
- if (pinfo)
+ if (!pinfo->flags.in_error_pkt) {
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ASAP");
+ }
/* create the asap protocol tree */
asap_item = proto_tree_add_item(tree, proto_asap, message_tvb, 0, -1, ENC_NA);
diff --git a/epan/dissectors/packet-babel.c b/epan/dissectors/packet-babel.c
index 964070b3..f2453907 100644
--- a/epan/dissectors/packet-babel.c
+++ b/epan/dissectors/packet-babel.c
@@ -337,6 +337,7 @@ dissect_babel_subtlvs(tvbuff_t * tvb, guint8 type, guint16 beg,
/* The following function is used to read the packet body and
the packet trailer */
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_babel_body(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
int offset, guint16 bodylen)
{
@@ -549,7 +550,9 @@ dissect_babel_body(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
subtree = proto_tree_add_subtree_format(tree, tvb, 4+bodylen, packet_len,
ett_packet_trailer, NULL,
"Packet Trailer (%u)", packet_len);
+ increment_dissection_depth(pinfo);
dissect_babel_body(tvb, pinfo, subtree, bodylen, packet_len);
+ decrement_dissection_depth(pinfo);
}
return i;
}
diff --git a/epan/dissectors/packet-bacnet.c b/epan/dissectors/packet-bacnet.c
index 9622113b..b9992482 100644
--- a/epan/dissectors/packet-bacnet.c
+++ b/epan/dissectors/packet-bacnet.c
@@ -477,6 +477,7 @@ bacnet_dissect_sec_wrapper(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tr
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_bacnet_npdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
{
proto_item *ti;
@@ -748,7 +749,10 @@ dissect_bacnet_npdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint of
tvb_set_reported_length(tvb, bacnet_len);
if (is_net_msg_flg) {
/* decode network layer message */
- return dissect_bacnet_npdu(tvb, pinfo, tree, offset);
+ increment_dissection_depth(pinfo);
+ int npdu_len = dissect_bacnet_npdu(tvb, pinfo, tree, offset);
+ decrement_dissection_depth(pinfo);
+ return npdu_len;
}
/* APDU - call the APDU dissector */
next_tvb = tvb_new_subset_remaining(tvb, offset);
diff --git a/epan/dissectors/packet-banana.c b/epan/dissectors/packet-banana.c
index 891b66a3..5a629c37 100644
--- a/epan/dissectors/packet-banana.c
+++ b/epan/dissectors/packet-banana.c
@@ -110,6 +110,7 @@ static const value_string pb_vals[] = {
/* Dissect the packets */
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_banana_element(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) {
proto_item *ti;
proto_tree *list_tree;
@@ -150,7 +151,9 @@ dissect_banana_element(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
list_tree = proto_item_add_subtree(ti, ett_list);
for (i = 0; i < val; i++) {
old_offset = offset;
+ increment_dissection_depth(pinfo);
offset += dissect_banana_element(tvb, pinfo, list_tree, offset);
+ decrement_dissection_depth(pinfo);
if (offset <= old_offset) {
return offset - start_offset;
}
diff --git a/epan/dissectors/packet-beep.c b/epan/dissectors/packet-beep.c
index 3e1b3fcc..56e4685e 100644
--- a/epan/dissectors/packet-beep.c
+++ b/epan/dissectors/packet-beep.c
@@ -437,6 +437,7 @@ set_mime_hdr_flags(int more, struct beep_request_val *request_val,
*/
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_beep_tree(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, struct beep_request_val *request_val,
struct beep_proto_data *beep_frame_data)
@@ -574,9 +575,11 @@ dissect_beep_tree(tvbuff_t *tvb, int offset, packet_info *pinfo,
/* If anything else left, dissect it ... */
- if (tvb_reported_length_remaining(tvb, offset) > 0)
+ if (tvb_reported_length_remaining(tvb, offset) > 0) {
+ increment_dissection_depth(pinfo);
offset += dissect_beep_tree(tvb, offset, pinfo, tree, request_val, beep_frame_data);
-
+ decrement_dissection_depth(pinfo);
+ }
} else if (tvb_strneql(tvb, offset, "SEQ ", 4) == 0) {
if (tree) {
diff --git a/epan/dissectors/packet-bencode.c b/epan/dissectors/packet-bencode.c
index 1f893e4c..93c042c3 100644
--- a/epan/dissectors/packet-bencode.c
+++ b/epan/dissectors/packet-bencode.c
@@ -163,6 +163,7 @@ static int dissect_bencoding_int(tvbuff_t *tvb, packet_info *pinfo,
return -1;
}
+// NOLINTNEXTLINE(misc-no-recursion)
static int dissect_bencoding_rec(tvbuff_t *tvb, packet_info *pinfo,
int offset, int length, proto_tree *tree, int level, proto_item *treei, int treeadd)
{
@@ -207,8 +208,12 @@ static int dissect_bencoding_rec(tvbuff_t *tvb, packet_info *pinfo,
}
op2len = -1;
- if ((length - op1len) > 2)
+ if ((length - op1len) > 2) {
+ increment_dissection_depth(pinfo);
op2len = dissect_bencoding_rec(tvb, pinfo, offset + used + op1len, length - op1len, NULL, level + 1, NULL, 0);
+ decrement_dissection_depth(pinfo);
+ }
+
if (op2len < 0) {
proto_tree_add_expert(dtree, pinfo, &ei_bencode_dict_value, tvb, offset + used + op1len, -1);
return op2len;
@@ -218,7 +223,9 @@ static int dissect_bencoding_rec(tvbuff_t *tvb, packet_info *pinfo,
itree = proto_item_add_subtree(ti, ett_bencode_dict_entry);
dissect_bencoding_str(tvb, pinfo, offset + used, length, itree, ti, 1);
+ increment_dissection_depth(pinfo);
dissect_bencoding_rec(tvb, pinfo, offset + used + op1len, length - op1len, itree, level + 1, ti, 2);
+ decrement_dissection_depth(pinfo);
used += op1len + op2len;
length -= op1len + op2len;
@@ -234,6 +241,7 @@ static int dissect_bencoding_rec(tvbuff_t *tvb, packet_info *pinfo,
used = 1;
length--;
+ increment_dissection_depth(pinfo);
while (length >= 1) {
op = tvb_get_guint8(tvb, offset + used);
@@ -242,11 +250,16 @@ static int dissect_bencoding_rec(tvbuff_t *tvb, packet_info *pinfo,
}
oplen = dissect_bencoding_rec(tvb, pinfo, offset + used, length, itree, level + 1, ti, 0);
- if (oplen < 1) return oplen;
+
+ if (oplen < 1) {
+ decrement_dissection_depth(pinfo);
+ return oplen;
+ }
used += oplen;
length -= oplen;
}
+ decrement_dissection_depth(pinfo);
proto_tree_add_item(itree, hf_bencode_truncated_data, tvb, offset + used, -1, ENC_NA);
return -1;
diff --git a/epan/dissectors/packet-bfcp.c b/epan/dissectors/packet-bfcp.c
index 3f356edc..f5c7889c 100644
--- a/epan/dissectors/packet-bfcp.c
+++ b/epan/dissectors/packet-bfcp.c
@@ -281,6 +281,7 @@ show_setup_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_bfcp_attributes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int bfcp_payload_length)
{
proto_item *ti, *item;
@@ -291,6 +292,7 @@ dissect_bfcp_attributes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
gint read_attr = 0;
guint8 first_byte, pad_len;
+ increment_dissection_depth(pinfo);
while ((tvb_reported_length_remaining(tvb, offset) >= 2) &&
((bfcp_payload_length - read_attr) >= 2))
{
@@ -499,6 +501,7 @@ dissect_bfcp_attributes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
}
read_attr = read_attr + length;
}
+ decrement_dissection_depth(pinfo);
return offset;
}
@@ -850,8 +853,7 @@ void proto_register_bfcp(void)
};
/* Register protocol name and description */
- proto_bfcp = proto_register_protocol("Binary Floor Control Protocol",
- "BFCP", "bfcp");
+ proto_bfcp = proto_register_protocol("Binary Floor Control Protocol", "BFCP", "bfcp");
bfcp_handle = register_dissector("bfcp", dissect_bfcp, proto_bfcp);
diff --git a/epan/dissectors/packet-bgp.c b/epan/dissectors/packet-bgp.c
index 75d9fc9a..85142598 100644
--- a/epan/dissectors/packet-bgp.c
+++ b/epan/dissectors/packet-bgp.c
@@ -5327,6 +5327,7 @@ decode_link_state_attribute_flex_algo_subtlv(proto_tree *tree, tvbuff_t *tvb, gi
* Decode a multiprotocol prefix
*/
static int
+// NOLINTNEXTLINE(misc-no-recursion)
decode_link_state_attribute_tlv(proto_tree *tree, tvbuff_t *tvb, gint offset, packet_info *pinfo, guint8 protocol_id)
{
guint16 type;
@@ -5350,6 +5351,7 @@ decode_link_state_attribute_tlv(proto_tree *tree, tvbuff_t *tvb, gint offset, pa
type = tvb_get_ntohs(tvb, offset);
length = tvb_get_ntohs(tvb, offset + 2);
+ increment_dissection_depth(pinfo);
switch (type) {
/* NODE ATTRIBUTE TLVs */
@@ -6449,6 +6451,7 @@ decode_link_state_attribute_tlv(proto_tree *tree, tvbuff_t *tvb, gint offset, pa
"Unknown BGP-LS Attribute TLV Code (%u)!", type);
break;
}
+ decrement_dissection_depth(pinfo);
return length + 4;
}
@@ -9574,6 +9577,7 @@ dissect_bgp_update_pmsi_attr(packet_info *pinfo, proto_tree *parent_tree, tvbuff
*
*/
void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_bgp_path_attr(proto_tree *subtree, tvbuff_t *tvb, guint16 path_attr_len, guint tvb_off, packet_info *pinfo)
{
guint8 bgpa_flags; /* path attributes */
@@ -9631,6 +9635,7 @@ dissect_bgp_path_attr(proto_tree *subtree, tvbuff_t *tvb, guint16 path_attr_len,
o = tvb_off;
+ increment_dissection_depth(pinfo);
while (i < path_attr_len) {
proto_item *ti_pa, *ti_flags;
int off;
@@ -10862,6 +10867,7 @@ dissect_bgp_path_attr(proto_tree *subtree, tvbuff_t *tvb, guint16 path_attr_len,
i += alen + aoff;
}
+ decrement_dissection_depth(pinfo);
{
/* FF: postponed BGPTYPE_LINK_STATE_ATTR dissection */
link_state_data *data = load_link_state_data(pinfo);
@@ -14102,8 +14108,7 @@ proto_register_bgp(void)
{NULL, NULL, -1}
};
- proto_bgp = proto_register_protocol("Border Gateway Protocol",
- "BGP", "bgp");
+ proto_bgp = proto_register_protocol("Border Gateway Protocol", "BGP", "bgp");
proto_register_field_array(proto_bgp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
expert_bgp = expert_register_protocol(proto_bgp);
diff --git a/epan/dissectors/packet-bt-dht.c b/epan/dissectors/packet-bt-dht.c
index 4d442a76..8b7a545b 100644
--- a/epan/dissectors/packet-bt-dht.c
+++ b/epan/dissectors/packet-bt-dht.c
@@ -187,6 +187,7 @@ static int dissect_bencoded_dict(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
/* dissect a bencoded list from tvb, start at offset. it's like "lXXXe", "X" is any bencoded thing */
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_bencoded_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, const char *label )
{
proto_item *ti;
@@ -428,6 +429,7 @@ dissect_bt_dht_nodes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_bencoded_dict_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset )
{
proto_item *ti;
@@ -556,6 +558,7 @@ dissect_bencoded_dict_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* dict = d...e */
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_bencoded_dict(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, const char *label )
{
proto_item *ti;
@@ -790,6 +793,7 @@ proto_reg_handoff_bt_dht(void)
{
heur_dissector_add("udp", dissect_bt_dht_heur, "BitTorrent DHT over UDP", "bittorrent_dht_udp", proto_bt_dht, HEURISTIC_ENABLE);
+ // If this is ever streamed (transported over TCP) we need to add recursion checks.
dissector_add_for_decode_as_with_preference("udp.port", bt_dht_handle);
}
diff --git a/epan/dissectors/packet-btbnep.c b/epan/dissectors/packet-btbnep.c
index 0ce39f97..533a765e 100644
--- a/epan/dissectors/packet-btbnep.c
+++ b/epan/dissectors/packet-btbnep.c
@@ -237,6 +237,7 @@ dissect_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_extension(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
guint8 extension_flag;
@@ -262,7 +263,9 @@ dissect_extension(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offse
offset += extension_length;
}
+ increment_dissection_depth(pinfo);
if (extension_flag) offset = dissect_extension(tvb, pinfo, tree, offset);
+ decrement_dissection_depth(pinfo);
return offset;
}
diff --git a/epan/dissectors/packet-btsdp.c b/epan/dissectors/packet-btsdp.c
index ef1141e8..c7bc939a 100644
--- a/epan/dissectors/packet-btsdp.c
+++ b/epan/dissectors/packet-btsdp.c
@@ -2113,6 +2113,7 @@ dissect_protocol_descriptor_list(proto_tree *next_tree, tvbuff_t *tvb,
static gint
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_sdp_type(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb,
gint offset, gint attribute, bluetooth_uuid_t service_uuid,
gint service_did_vendor_id, gint service_did_vendor_id_source,
@@ -3532,6 +3533,7 @@ dissect_sdp_type(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb,
wmem_strbuf_append(info_buf, "{ ");
+ increment_dissection_depth(pinfo);
while (bytes_to_go > 0) {
if (!first) {
wmem_strbuf_append(info_buf, ", ");
@@ -3550,6 +3552,7 @@ dissect_sdp_type(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb,
next_offset += size;
bytes_to_go -= size;
}
+ decrement_dissection_depth(pinfo);
wmem_strbuf_append(info_buf, "} ");
break;
diff --git a/epan/dissectors/packet-bvlc.c b/epan/dissectors/packet-bvlc.c
index 58acc3a9..3fe10a36 100644
--- a/epan/dissectors/packet-bvlc.c
+++ b/epan/dissectors/packet-bvlc.c
@@ -503,6 +503,7 @@ static int * const bscvlc_header_flags[] = {
};
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_ipv4_bvlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
@@ -664,7 +665,9 @@ dissect_ipv4_bvlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
call_data_dissector(tvb, pinfo, tree);
return tvb_captured_length(tvb);
}
+ increment_dissection_depth(pinfo);
dissect_ipv4_bvlc(tvb, pinfo, tree, data);
+ decrement_dissection_depth(pinfo);
break;
/* We check this if we get a FDT-packet somewhere */
case 0x04: /* Forwarded-NPDU
@@ -704,6 +707,7 @@ dissect_ipv4_bvlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_ipv6_bvlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
proto_item *ti;
@@ -851,7 +855,9 @@ dissect_ipv6_bvlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
call_data_dissector(tvb, pinfo, tree);
return tvb_captured_length(tvb);
}
+ increment_dissection_depth(pinfo);
dissect_ipv6_bvlc(tvb, pinfo, tree, data);
+ decrement_dissection_depth(pinfo);
break;
case 0x02: /* Original-Broadcast-NPDU */
case 0x0c: /* Distribute-Broadcast-To-Network */
diff --git a/epan/dissectors/packet-cip.c b/epan/dissectors/packet-cip.c
index 13cb87a2..5f22dd52 100644
--- a/epan/dissectors/packet-cip.c
+++ b/epan/dissectors/packet-cip.c
@@ -6643,6 +6643,7 @@ dissect_cip_set_attribute_list_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree
return 2 + (offset - start_offset);
}
+// NOLINTNEXTLINE(misc-no-recursion)
int dissect_cip_multiple_service_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item * item, int offset, gboolean request)
{
proto_tree *mult_serv_tree, *offset_tree;
@@ -6773,6 +6774,7 @@ int dissect_cip_multiple_service_packet(tvbuff_t *tvb, packet_info *pinfo, proto
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_cip_generic_service_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, cip_simple_request_info_t* req_data)
{
proto_item *cmd_data_item;
@@ -7149,6 +7151,7 @@ gboolean should_dissect_cip_response(tvbuff_t *tvb, int offset, guint8 gen_statu
}
int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_cip_generic_service_rsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item *cmd_data_item;
@@ -9230,6 +9233,7 @@ dissect_class_cco_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
*
************************************************/
+// NOLINTNEXTLINE(misc-no-recursion)
void dissect_cip_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, packet_info *pinfo, cip_req_info_t* preq_info, proto_item* msp_item, gboolean is_msp_item )
{
proto_item *ti;
@@ -9266,6 +9270,7 @@ void dissect_cip_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, packet_
proto_tree_add_item( rrsc_tree, hf_cip_reqrsp, tvb, offset, 1, ENC_LITTLE_ENDIAN);
proto_tree_add_item(rrsc_tree, hf_cip_service_code, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ increment_dissection_depth(pinfo);
if( service & CIP_SC_RESPONSE_MASK )
{
/* Response message */
@@ -9432,6 +9437,8 @@ void dissect_cip_data( proto_tree *item_tree, tvbuff_t *tvb, int offset, packet_
}
} /* End of if-else( request ) */
+ decrement_dissection_depth(pinfo);
+
p_remove_proto_data(wmem_file_scope(), pinfo, proto_cip, 0);
p_add_proto_data(wmem_file_scope(), pinfo, proto_cip, 0, p_save_proto_data);
diff --git a/epan/dissectors/packet-cmip.c b/epan/dissectors/packet-cmip.c
index b3aaa2b9..b7ccee3c 100644
--- a/epan/dissectors/packet-cmip.c
+++ b/epan/dissectors/packet-cmip.c
@@ -602,7 +602,6 @@ static const char *object_identifier_id;
static int dissect_cmip_CMISFilter(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
-#define MAX_RECURSION_DEPTH 100 // Arbitrarily chosen.
static int
@@ -1012,16 +1011,15 @@ static const ber_choice_t CMISFilter_choice[] = {
static int
dissect_cmip_CMISFilter(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 3;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // CMISFilter → CMISFilter/and → CMISFilter
+ actx->pinfo->dissection_depth += 2;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_choice(actx, tree, tvb, offset,
CMISFilter_choice, hf_index, ett_cmip_CMISFilter,
NULL);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 2;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
diff --git a/epan/dissectors/packet-cmp.c b/epan/dissectors/packet-cmp.c
index 30c422e2..64bc3100 100644
--- a/epan/dissectors/packet-cmp.c
+++ b/epan/dissectors/packet-cmp.c
@@ -277,7 +277,6 @@ static gint ett_cmp_PollRepContent_item = -1;
/*int dissect_cmp_PKIMessage(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);*/
-#define MAX_RECURSION_DEPTH 100 // Arbitrarily chosen.
static const value_string cmp_CMPCertificate_vals[] = {
{ 0, "x509v3PKCert" },
@@ -1088,15 +1087,14 @@ static const ber_sequence_t PKIMessage_sequence[] = {
int
dissect_cmp_PKIMessage(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 5;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // PKIMessage → PKIBody → NestedMessageContent → PKIMessages → PKIMessage
+ actx->pinfo->dissection_depth += 4;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
PKIMessage_sequence, hf_index, ett_cmp_PKIMessage);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 4;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
diff --git a/epan/dissectors/packet-corosync-totemsrp.c b/epan/dissectors/packet-corosync-totemsrp.c
index 6f0feaf8..fce101da 100644
--- a/epan/dissectors/packet-corosync-totemsrp.c
+++ b/epan/dissectors/packet-corosync-totemsrp.c
@@ -473,6 +473,7 @@ dissect_corosync_totemsrp_srp_addr(tvbuff_t *tvb,
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_corosync_totemsrp_mcast(tvbuff_t *tvb,
packet_info *pinfo, proto_tree *tree,
guint length, int offset,
@@ -797,6 +798,7 @@ dissect_corosync_totemsrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_
#define COROSYNC_TOTEMSRP_TEST_BIG_ENDIAN 0xFF22
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_corosync_totemsrp0(tvbuff_t *tvb,
packet_info *pinfo, proto_tree *tree,
gboolean encapsulated)
@@ -868,6 +870,7 @@ dissect_corosync_totemsrp0(tvbuff_t *tvb,
info.nodeid = corosync_totemsrp_get_guint32(tvb, offset, encoding);
offset += 4;
+ increment_dissection_depth(pinfo);
switch (message_header__type) {
case COROSYNC_TOTEMSRP_MESSAGE_TYPE_ORF_TOKEN:
dissect_corosync_totemsrp_orf_token(tvb, pinfo, corosync_tree, length, offset, encoding);
@@ -896,6 +899,7 @@ dissect_corosync_totemsrp0(tvbuff_t *tvb,
default:
break;
}
+ decrement_dissection_depth(pinfo);
return length;
}
diff --git a/epan/dissectors/packet-cose.c b/epan/dissectors/packet-cose.c
index 5f5a7e6e..2637c1fa 100644
--- a/epan/dissectors/packet-cose.c
+++ b/epan/dissectors/packet-cose.c
@@ -558,6 +558,8 @@ static void dissect_ciphertext(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
}
}
static void dissect_cose_recipient(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *offset);
+
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_cose_recipient_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *offset) {
wscbor_chunk_t *chunk_list = wscbor_chunk_read(pinfo->pool, tvb, offset);
wscbor_require_array(chunk_list);
@@ -571,6 +573,8 @@ static void dissect_cose_recipient_list(tvbuff_t *tvb, packet_info *pinfo, proto
}
proto_item_set_len(item_list, *offset - chunk_list->start);
}
+
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_cose_recipient(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *offset) {
wscbor_chunk_t *chunk_recip = wscbor_chunk_read(pinfo->pool, tvb, offset);
wscbor_require_array_size(chunk_recip, 3, 4);
@@ -581,7 +585,9 @@ static void dissect_cose_recipient(tvbuff_t *tvb, packet_info *pinfo, proto_tree
dissect_headers(tvb, pinfo, tree_recip, offset);
dissect_ciphertext(tvb, pinfo, tree_recip, offset);
if (chunk_recip->head_value > 3) {
+ increment_dissection_depth(pinfo);
dissect_cose_recipient_list(tvb, pinfo, tree_recip, offset);
+ decrement_dissection_depth(pinfo);
}
}
proto_item_set_len(item_recip, *offset - chunk_recip->start);
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);
}
}
diff --git a/epan/dissectors/packet-csn1.c b/epan/dissectors/packet-csn1.c
index 15b4a718..815e7708 100644
--- a/epan/dissectors/packet-csn1.c
+++ b/epan/dissectors/packet-csn1.c
@@ -150,6 +150,7 @@ existNextElement(tvbuff_t *tvb, gint bit_offset, guint8 Tag)
gint16
+// NOLINTNEXTLINE(misc-no-recursion)
csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, tvbuff_t *tvb, void* data, int ett_csn1)
{
gint remaining_bits_len = ar->remaining_bits_len;
@@ -475,7 +476,9 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
test_tree = proto_tree_add_subtree_format(tree, tvb, bit_offset>>3, 1, ett_csn1, &ti, "%s[%d]",pDescr->sz, i++);
csnStreamInit(&arT, bit_offset, remaining_bits_len, ar->pinfo);
+ increment_dissection_depth(ar->pinfo);
Status = csnStreamDissector(test_tree, &arT, (const CSN_DESCR*)pDescr->descr.ptr, tvb, pui8, ett_csn1);
+ decrement_dissection_depth(ar->pinfo);
if (Status >= 0)
{
pui8 += nSize;
@@ -539,7 +542,9 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
} else {
test_tree = proto_tree_add_subtree_format(tree, tvb, bit_offset>>3, 1, ett_csn1, &ti, "%s", pDescr->sz);
csnStreamInit(&arT, bit_offset, remaining_bits_len, ar->pinfo);
+ increment_dissection_depth(ar->pinfo);
Status = csnStreamDissector(test_tree, &arT, (const CSN_DESCR*)pDescr->descr.ptr, tvb, pvDATA(data, pDescr->offset), ett_csn1);
+ decrement_dissection_depth(ar->pinfo);
if (Status >= 0)
{
proto_item_set_len(ti,((arT.bit_offset-1)>>3) - (bit_offset>>3)+1);
@@ -604,7 +609,9 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
}
csnStreamInit(&arT, bit_offset, remaining_bits_len, ar->pinfo);
+ increment_dissection_depth(ar->pinfo);
Status = csnStreamDissector(test_tree, &arT, (const CSN_DESCR*)descr, tvb, data, ett_csn1);
+ decrement_dissection_depth(ar->pinfo);
if (Status >= 0)
{
@@ -960,7 +967,9 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
test_tree = proto_tree_add_subtree_format(tree, tvb, bit_offset>>3, 1, ett_csn1, &ti, "%s[%d]",pDescr->sz, i++);
csnStreamInit(&arT, bit_offset, remaining_bits_len, ar->pinfo);
+ increment_dissection_depth(ar->pinfo);
Status = csnStreamDissector(test_tree, &arT, (const CSN_DESCR *)pDescr->descr.ptr, tvb, pui8, ett_csn1);
+ decrement_dissection_depth(ar->pinfo);
if (Status >= 0)
{
pui8 += nSize;
@@ -1013,7 +1022,9 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
} else {
test_tree = proto_tree_add_subtree(tree, tvb, bit_offset>>3, 1, ett_csn1, &ti, pDescr->sz);
csnStreamInit(&arT, bit_offset, remaining_bits_len, ar->pinfo);
+ increment_dissection_depth(ar->pinfo);
Status = csnStreamDissector(test_tree, &arT, (const CSN_DESCR *)pDescr->descr.ptr, tvb, pvDATA(data, pDescr->offset), ett_csn1);
+ decrement_dissection_depth(ar->pinfo);
if (Status >= 0)
{
proto_item_set_len(ti,((arT.bit_offset-1)>>3) - (bit_offset>>3)+1);
@@ -1405,7 +1416,9 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
test_tree = proto_tree_add_subtree(tree, tvb, bit_offset>>3, 1, ett_csn1, &ti, pDescr->sz);
csnStreamInit(&arT, bit_offset, remaining_bits_len, ar->pinfo);
+ increment_dissection_depth(ar->pinfo);
Status = csnStreamDissector(test_tree, &arT, (const CSN_DESCR *)pDescr->descr.ptr, tvb, pvDATA(data, pDescr->offset), ett_csn1);
+ decrement_dissection_depth(ar->pinfo);
if (Status >= 0)
{ /* successful completion */
@@ -1474,7 +1487,9 @@ csnStreamDissector(proto_tree *tree, csnStream_t* ar, const CSN_DESCR* pDescr, t
test_tree = proto_tree_add_subtree_format(tree, tvb, bit_offset>>3, 1, ett_csn1, &ti, "%s[%d]", pDescr->sz, ElementCount-1);
csnStreamInit(&arT, bit_offset, remaining_bits_len, ar->pinfo);
+ increment_dissection_depth(ar->pinfo);
Status = csnStreamDissector(test_tree, &arT, (const CSN_DESCR *)pDescr->descr.ptr, tvb, pvDATA(data, pDescr->offset), ett_csn1);
+ decrement_dissection_depth(ar->pinfo);
if (Status >= 0)
{ /* successful completion */
diff --git a/epan/dissectors/packet-dap.c b/epan/dissectors/packet-dap.c
index bb5c9d5d..8a823140 100644
--- a/epan/dissectors/packet-dap.c
+++ b/epan/dissectors/packet-dap.c
@@ -701,7 +701,6 @@ static int dissect_dap_ListResultData(bool implicit_tag _U_, tvbuff_t *tvb _U_,
static int dissect_dap_SearchResultData(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
-#define MAX_RECURSION_DEPTH 100 // Arbitrarily chosen.
const value_string dap_FamilyGrouping_vals[] = {
{ 1, "entryOnly" },
@@ -1266,15 +1265,14 @@ static const ber_sequence_t FamilyEntries_sequence[] = {
static int
dissect_dap_FamilyEntries(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 5;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // FamilyEntries → FamilyEntries/familyEntries → FamilyEntry → FamilyEntry/family-info → FamilyEntries
+ actx->pinfo->dissection_depth += 4;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
FamilyEntries_sequence, hf_index, ett_dap_FamilyEntries);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 4;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
@@ -1470,16 +1468,15 @@ static const ber_choice_t Filter_choice[] = {
int
dissect_dap_Filter(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 3;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // Filter → SetOfFilter → Filter
+ actx->pinfo->dissection_depth += 2;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_choice(actx, tree, tvb, offset,
Filter_choice, hf_index, ett_dap_Filter,
NULL);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 2;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
@@ -2932,16 +2929,15 @@ static const ber_choice_t ListResultData_choice[] = {
static int
dissect_dap_ListResultData(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 4;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // ListResultData → ListResultData/uncorrelatedListInfo → ListResult → ListResultData
+ actx->pinfo->dissection_depth += 3;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_choice(actx, tree, tvb, offset,
ListResultData_choice, hf_index, ett_dap_ListResultData,
NULL);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 3;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
@@ -3323,16 +3319,15 @@ static const ber_choice_t SearchResultData_choice[] = {
static int
dissect_dap_SearchResultData(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 4;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // SearchResultData → SearchResultData/uncorrelatedSearchInfo → SearchResult → SearchResultData
+ actx->pinfo->dissection_depth += 3;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_choice(actx, tree, tvb, offset,
SearchResultData_choice, hf_index, ett_dap_SearchResultData,
NULL);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 3;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
diff --git a/epan/dissectors/packet-dccp.c b/epan/dissectors/packet-dccp.c
index 3481698c..e03154e5 100644
--- a/epan/dissectors/packet-dccp.c
+++ b/epan/dissectors/packet-dccp.c
@@ -755,6 +755,7 @@ dissect_feature_options(proto_tree *dccp_options_tree, tvbuff_t *tvb,
* This function dissects DCCP options
*/
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_options(tvbuff_t *tvb, packet_info *pinfo,
proto_tree *dccp_options_tree, proto_tree *tree _U_,
e_dccphdr *dccph _U_,
@@ -890,6 +891,7 @@ dissect_options(tvbuff_t *tvb, packet_info *pinfo,
mp_option_sub_item = proto_tree_add_item(option_tree, hf_mpdccp_confirm, tvb, offset, 1, ENC_BIG_ENDIAN);
mp_option_sub_tree = proto_item_add_subtree(mp_option_sub_item, ett_dccp_options_item);
offset += 1;
+ // We recurse here, but we'll run out of packet before we run out of stack.
dissect_options(tvb, pinfo, mp_option_sub_tree, tree, dccph, offset, offset + option_len);
break;
case 1:
@@ -1943,8 +1945,7 @@ proto_register_dccp(void)
expert_module_t* expert_dccp;
proto_dccp =
- proto_register_protocol("Datagram Congestion Control Protocol", "DCCP",
- "dccp");
+ proto_register_protocol("Datagram Congestion Control Protocol", "DCCP", "dccp");
dccp_handle = register_dissector("dccp", dissect_dccp, proto_dccp);
proto_register_field_array(proto_dccp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
diff --git a/epan/dissectors/packet-dcm.c b/epan/dissectors/packet-dcm.c
index fab18c61..f6e74084 100644
--- a/epan/dissectors/packet-dcm.c
+++ b/epan/dissectors/packet-dcm.c
@@ -664,7 +664,7 @@ typedef struct dcm_status {
const gchar *description;
} dcm_status_t;
-static dcm_status_t dcm_status_data[] = {
+static dcm_status_t const dcm_status_data[] = {
/* From PS 3.7 */
@@ -1010,11 +1010,11 @@ static const gchar *
dcm_rsp2str(guint16 status_value)
{
- dcm_status_t *status = NULL;
+ dcm_status_t const *status = NULL;
const gchar *s;
/* Use specific text first */
- status = (dcm_status_t*) wmem_map_lookup(dcm_status_table, GUINT_TO_POINTER((guint32)status_value));
+ status = (dcm_status_t const *)wmem_map_lookup(dcm_status_table, GUINT_TO_POINTER((guint32)status_value));
if (status) {
s = status->description;
@@ -1657,7 +1657,7 @@ dissect_dcm_assoc_item(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guin
proto_tree *assoc_item_ptree; /* Tree for item details */
proto_item *assoc_item_pitem;
- dcm_uid_t *uid = NULL;
+ dcm_uid_t const *uid = NULL;
guint32 item_number = 0;
@@ -1681,7 +1681,7 @@ dissect_dcm_assoc_item(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guin
case DCM_ITEM_VALUE_TYPE_UID:
*item_value = (gchar *)tvb_get_string_enc(pinfo->pool, tvb, offset+4, item_len, ENC_ASCII);
- uid = (dcm_uid_t *)wmem_map_lookup(dcm_uid_table, (gpointer) *item_value);
+ uid = (dcm_uid_t const *)wmem_map_lookup(dcm_uid_table, (gpointer) *item_value);
if (uid) {
*item_description = uid->name;
buf_desc = wmem_strdup_printf(pinfo->pool, "%s (%s)", *item_description, *item_value);
@@ -1733,7 +1733,7 @@ dissect_dcm_assoc_sopclass_extneg(tvbuff_t *tvb, packet_info *pinfo, proto_tree
gint32 cnt = 0;
gchar *buf_desc = NULL; /* Used for item text */
- dcm_uid_t *sopclassuid=NULL;
+ dcm_uid_t const *sopclassuid=NULL;
gchar *sopclassuid_str = NULL;
item_len = tvb_get_ntohs(tvb, offset+2);
@@ -1748,7 +1748,7 @@ dissect_dcm_assoc_sopclass_extneg(tvbuff_t *tvb, packet_info *pinfo, proto_tree
proto_tree_add_item(assoc_item_extneg_tree, hf_dcm_info_extneg_sopclassuid_len, tvb, offset+4, 2, ENC_BIG_ENDIAN);
sopclassuid_str = (gchar *)tvb_get_string_enc(pinfo->pool, tvb, offset+6, sop_class_uid_len, ENC_ASCII);
- sopclassuid = (dcm_uid_t *)wmem_map_lookup(dcm_uid_table, (gpointer) sopclassuid_str);
+ sopclassuid = (dcm_uid_t const *)wmem_map_lookup(dcm_uid_table, (gpointer) sopclassuid_str);
if (sopclassuid) {
buf_desc = wmem_strdup_printf(pinfo->pool, "%s (%s)", sopclassuid->name, sopclassuid->value);
@@ -1907,7 +1907,7 @@ dissect_dcm_assoc_role_selection(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
guint8 scp_role, scu_role;
gchar *buf_desc; /* Used for item text */
- dcm_uid_t *sopclassuid;
+ dcm_uid_t const *sopclassuid;
gchar *sopclassuid_str;
item_len = tvb_get_ntohs(tvb, offset+2);
@@ -1922,7 +1922,7 @@ dissect_dcm_assoc_role_selection(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
proto_tree_add_item(assoc_item_rolesel_tree, hf_dcm_info_rolesel_sopclassuid_len, tvb, offset+4, 2, ENC_BIG_ENDIAN);
sopclassuid_str = (gchar *)tvb_get_string_enc(pinfo->pool, tvb, offset+6, sop_class_uid_len, ENC_ASCII);
- sopclassuid = (dcm_uid_t *)wmem_map_lookup(dcm_uid_table, (gpointer) sopclassuid_str);
+ sopclassuid = (dcm_uid_t const *)wmem_map_lookup(dcm_uid_table, (gpointer) sopclassuid_str);
scu_role = tvb_get_guint8(tvb, offset+6+sop_class_uid_len);
scp_role = tvb_get_guint8(tvb, offset+7+sop_class_uid_len);
@@ -2574,7 +2574,7 @@ dissect_dcm_tag_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dcm_s
*/
gchar *vals;
- dcm_uid_t *uid = NULL;
+ dcm_uid_t const *uid = NULL;
guint8 val8;
val8 = tvb_get_guint8(tvb, offset + vl_max - 1);
@@ -2594,7 +2594,7 @@ dissect_dcm_tag_value(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dcm_s
if ((strncmp(vr, "UI", 2) == 0)) {
/* This is a UID. Attempt a lookup. Will only return something for classes of course */
- uid = (dcm_uid_t *)wmem_map_lookup(dcm_uid_table, (gpointer) vals);
+ uid = (dcm_uid_t const *)wmem_map_lookup(dcm_uid_table, (gpointer) vals);
if (uid) {
*tag_value = wmem_strdup_printf(pinfo->pool, "%s (%s)", vals, uid->name);
}
@@ -2828,19 +2828,19 @@ dcm_tag_is_open(dcm_state_pdv_t *pdv, guint32 startpos, guint32 offset, guint32
}
}
-static dcm_tag_t*
+static dcm_tag_t const *
dcm_tag_lookup(guint16 grp, guint16 elm)
{
- static dcm_tag_t *tag_def = NULL;
+ static dcm_tag_t const *tag_def = NULL;
- static dcm_tag_t tag_unknown = { 0x00000000, "(unknown)", "UN", "1", 0, 0};
- static dcm_tag_t tag_private = { 0x00000000, "Private Tag", "UN", "1", 0, 0 };
- static dcm_tag_t tag_private_grp_len = { 0x00000000, "Private Tag Group Length", "UL", "1", 0, 0 };
- static dcm_tag_t tag_grp_length = { 0x00000000, "Group Length", "UL", "1", 0, 0 };
+ static dcm_tag_t const tag_unknown = { 0x00000000, "(unknown)", "UN", "1", 0, 0};
+ static dcm_tag_t const tag_private = { 0x00000000, "Private Tag", "UN", "1", 0, 0 };
+ static dcm_tag_t const tag_private_grp_len = { 0x00000000, "Private Tag Group Length", "UL", "1", 0, 0 };
+ static dcm_tag_t const tag_grp_length = { 0x00000000, "Group Length", "UL", "1", 0, 0 };
/* Try a direct hit first before doing a masked search */
- tag_def = (dcm_tag_t *)wmem_map_lookup(dcm_tag_table, GUINT_TO_POINTER(((guint32)grp << 16) | elm));
+ tag_def = (dcm_tag_t const *)wmem_map_lookup(dcm_tag_table, GUINT_TO_POINTER(((guint32)grp << 16) | elm));
if (tag_def == NULL) {
@@ -2858,23 +2858,23 @@ dcm_tag_lookup(guint16 grp, guint16 elm)
/* There are a few tags that require a mask to be found */
else if (((grp & 0xFF00) == 0x5000) || ((grp & 0xFF00) == 0x6000) || ((grp & 0xFF00) == 0x7F00)) {
/* Do a special for groups 0x50xx, 0x60xx and 0x7Fxx */
- tag_def = (dcm_tag_t *)wmem_map_lookup(dcm_tag_table, GUINT_TO_POINTER((((guint32)grp & 0xFF00) << 16) | elm));
+ tag_def = (dcm_tag_t const *)wmem_map_lookup(dcm_tag_table, GUINT_TO_POINTER((((guint32)grp & 0xFF00) << 16) | elm));
}
else if ((grp == 0x0020) && ((elm & 0xFF00) == 0x3100)) {
- tag_def = (dcm_tag_t *)wmem_map_lookup(dcm_tag_table, GUINT_TO_POINTER(((guint32)grp << 16) | (elm & 0xFF00)));
+ tag_def = (dcm_tag_t const *)wmem_map_lookup(dcm_tag_table, GUINT_TO_POINTER(((guint32)grp << 16) | (elm & 0xFF00)));
}
else if ((grp == 0x0028) && ((elm & 0xFF00) == 0x0400)) {
/* This map was done to 0x041x */
- tag_def = (dcm_tag_t *)wmem_map_lookup(dcm_tag_table, GUINT_TO_POINTER(((guint32)grp << 16) | (elm & 0xFF0F) | 0x0010));
+ tag_def = (dcm_tag_t const *)wmem_map_lookup(dcm_tag_table, GUINT_TO_POINTER(((guint32)grp << 16) | (elm & 0xFF0F) | 0x0010));
}
else if ((grp == 0x0028) && ((elm & 0xFF00) == 0x0800)) {
- tag_def = (dcm_tag_t *)wmem_map_lookup(dcm_tag_table, GUINT_TO_POINTER(((guint32)grp << 16) | (elm & 0xFF0F)));
+ tag_def = (dcm_tag_t const *)wmem_map_lookup(dcm_tag_table, GUINT_TO_POINTER(((guint32)grp << 16) | (elm & 0xFF0F)));
}
else if (grp == 0x1000) {
- tag_def = (dcm_tag_t *)wmem_map_lookup(dcm_tag_table, GUINT_TO_POINTER(((guint32)grp << 16) | (elm & 0x000F)));
+ tag_def = (dcm_tag_t const *)wmem_map_lookup(dcm_tag_table, GUINT_TO_POINTER(((guint32)grp << 16) | (elm & 0x000F)));
}
else if (grp == 0x1010) {
- tag_def = (dcm_tag_t *)wmem_map_lookup(dcm_tag_table, GUINT_TO_POINTER(((guint32)grp << 16) | (elm & 0x0000)));
+ tag_def = (dcm_tag_t const *)wmem_map_lookup(dcm_tag_table, GUINT_TO_POINTER(((guint32)grp << 16) | (elm & 0x0000)));
}
if (tag_def == NULL) {
@@ -2920,6 +2920,7 @@ Decode one tag. If it is a sequence or item start create a subtree. Returns new
http://dicom.nema.org/medical/dicom/current/output/chtml/part05/chapter_7.html
*/
static guint32
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_dcm_tag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
dcm_state_pdv_t *pdv, guint32 offset, guint32 endpos,
gboolean is_first_tag, const gchar **tag_description,
@@ -2927,11 +2928,11 @@ dissect_dcm_tag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
{
- proto_tree *tag_ptree = NULL; /* Tree for decoded tag details */
- proto_tree *seq_ptree = NULL; /* Possible subtree for sequences and items */
+ proto_tree *tag_ptree = NULL; /* Tree for decoded tag details */
+ proto_tree *seq_ptree = NULL; /* Possible subtree for sequences and items */
- proto_item *tag_pitem = NULL;
- dcm_tag_t *tag_def = NULL;
+ proto_item *tag_pitem = NULL;
+ dcm_tag_t const *tag_def = NULL;
gint ett;
@@ -3220,6 +3221,7 @@ dissect_dcm_tag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (vl == 0xFFFFFFFF) {
/* Undefined length */
+ increment_dissection_depth(pinfo);
while ((!local_end_of_seq_or_item) && (!pdv->open_tag.is_header_fragmented) && (offset < endpos)) {
offset = dissect_dcm_tag(tvb, pinfo, seq_ptree, pdv, offset, endpos, FALSE, &item_description, &local_end_of_seq_or_item);
@@ -3229,11 +3231,13 @@ dissect_dcm_tag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
is_first_desc = FALSE;
}
}
+ decrement_dissection_depth(pinfo);
}
else {
/* Defined length */
endpos_item = offset + vl_max;
+ increment_dissection_depth(pinfo);
while (offset < endpos_item) {
offset = dissect_dcm_tag(tvb, pinfo, seq_ptree, pdv, offset, endpos_item, FALSE, &item_description, &local_end_of_seq_or_item);
@@ -3243,6 +3247,7 @@ dissect_dcm_tag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
is_first_desc = FALSE;
}
}
+ decrement_dissection_depth(pinfo);
}
} /* if ((is_sequence || is_item) && (vl > 0)) */
else if ((grp == 0xFFFE) && (elm == 0xE00D)) {
@@ -3292,7 +3297,9 @@ dissect_dcm_tag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
else {
/* Regular value. Identify the type, decode and display */
+ increment_dissection_depth(pinfo);
offset = dissect_dcm_tag_value(tvb, pinfo, tag_ptree, pdv, offset, grp, elm, vl, vl_max, vr, &tag_value);
+ decrement_dissection_depth(pinfo);
/* -------------------------------------------------------------
We have decoded the value. Now store those tags of interest
diff --git a/epan/dissectors/packet-dcm.h b/epan/dissectors/packet-dcm.h
index e132f31e..3b44b8d1 100644
--- a/epan/dissectors/packet-dcm.h
+++ b/epan/dissectors/packet-dcm.h
@@ -93,7 +93,7 @@ typedef struct dcm_tag {
const gboolean add_to_summary; /* Add to parent's item description */
} dcm_tag_t;
-static dcm_tag_t dcm_tag_data[] = {
+static dcm_tag_t const dcm_tag_data[] = {
/* Command Tags */
{ 0x00000000, "Command Group Length", "UL", "1", 0, 0},
@@ -5498,7 +5498,7 @@ typedef struct dcm_uid {
#define DCM_UID_LDAP_OID_DICOMTRANSFERCAPABILITY "1.2.840.10008.15.0.4.8"
#define DCM_UID_SYNCHRONIZATION_FRAME_OF_REFERENCE_UNIVERSAL_COORDINATED_TIME "1.2.840.10008.15.1.1"
-static dcm_uid_t dcm_uid_data[] = {
+static dcm_uid_t const dcm_uid_data[] = {
{ DCM_UID_SOP_CLASS_VERIFICATION, "Verification SOP Class", "SOP Class"},
{ DCM_UID_TRANSFER_SYNTAX_IMPLICIT_VR_LITTLE_ENDIAN, "Implicit VR Little Endian: Default Transfer Syntax for DICOM", "Transfer Syntax"},
{ DCM_UID_TRANSFER_SYNTAX_EXPLICIT_VR_LITTLE_ENDIAN, "Explicit VR Little Endian", "Transfer Syntax"},
diff --git a/epan/dissectors/packet-dcom.c b/epan/dissectors/packet-dcom.c
index 14f7d601..a3eb6142 100644
--- a/epan/dissectors/packet-dcom.c
+++ b/epan/dissectors/packet-dcom.c
@@ -1289,6 +1289,7 @@ dissect_dcom_VARTYPE(tvbuff_t *tvb, int offset, packet_info *pinfo,
int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_dcom_VARIANT(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex)
{
@@ -1349,6 +1350,7 @@ dissect_dcom_VARIANT(tvbuff_t *tvb, int offset, packet_info *pinfo,
offset = dissect_dcom_dcerpc_pointer(tvb, offset, pinfo, sub_tree, di, drep, &u32Pointer);
}
+ increment_dissection_depth(pinfo);
switch (u32VarType) {
case(WIRESHARK_VT_EMPTY):
break;
@@ -1445,6 +1447,7 @@ dissect_dcom_VARIANT(tvbuff_t *tvb, int offset, packet_info *pinfo,
offset = dissect_dcom_tobedone_data(tvb, offset, pinfo, sub_tree, drep,
10000);
}
+ decrement_dissection_depth(pinfo);
/* update subtree header */
proto_item_append_text(sub_item, ": %s",
diff --git a/epan/dissectors/packet-dhcpv6.c b/epan/dissectors/packet-dhcpv6.c
index 1ca4ac36..bbbbff83 100644
--- a/epan/dissectors/packet-dhcpv6.c
+++ b/epan/dissectors/packet-dhcpv6.c
@@ -1843,6 +1843,7 @@ cablelabs_fmt_dpoe_server_version( gchar *result, guint32 revision )
/* Returns the number of bytes consumed by this option. */
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
int off, int eoff, gboolean *at_end, int protocol, hopcount_info hpi, guint8 msgtype)
{
@@ -1883,6 +1884,8 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
proto_tree_add_item(subtree, hf_option_length, tvb, off + 2, 2, ENC_BIG_ENDIAN);
off += 4;
+ increment_dissection_depth(pinfo);
+
switch (opttype) {
case OPTION_CLIENTID:
if (optlen > 0) {
@@ -2949,12 +2952,15 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
break;
}
+ decrement_dissection_depth(pinfo);
+
return 4 + optlen;
}
-/* May be called recursively */
+/* May be called recursively via dhcpv6_option */
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_dhcpv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
int off, int eoff, hopcount_info hpi)
{
diff --git a/epan/dissectors/packet-disp.c b/epan/dissectors/packet-disp.c
index 7d206fb0..61325352 100644
--- a/epan/dissectors/packet-disp.c
+++ b/epan/dissectors/packet-disp.c
@@ -232,7 +232,6 @@ static int dissect_disp_Subtree(bool implicit_tag _U_, tvbuff_t *tvb _U_, int of
static int dissect_disp_IncrementalStepRefresh(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
-#define MAX_RECURSION_DEPTH 100 // Arbitrarily chosen.
static int
@@ -1042,15 +1041,14 @@ static const ber_sequence_t Subtree_sequence[] = {
static int
dissect_disp_Subtree(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 3;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // Subtree → Subtree/subtree → Subtree
+ actx->pinfo->dissection_depth += 2;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
Subtree_sequence, hf_index, ett_disp_Subtree);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 2;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
@@ -1206,15 +1204,14 @@ static const ber_sequence_t IncrementalStepRefresh_sequence[] = {
static int
dissect_disp_IncrementalStepRefresh(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 4;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // IncrementalStepRefresh → IncrementalStepRefresh/subordinateUpdates → SubordinateChanges → IncrementalStepRefresh
+ actx->pinfo->dissection_depth += 3;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
IncrementalStepRefresh_sequence, hf_index, ett_disp_IncrementalStepRefresh);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 3;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
diff --git a/epan/dissectors/packet-docsis-macmgmt.c b/epan/dissectors/packet-docsis-macmgmt.c
index 23864bbf..e3bf924a 100644
--- a/epan/dissectors/packet-docsis-macmgmt.c
+++ b/epan/dissectors/packet-docsis-macmgmt.c
@@ -3832,6 +3832,7 @@ dissect_uccrsp (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* da
* attributes. It's called recursively, to dissect embedded attributes
*/
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_attrs (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
{
guint8 type;
@@ -3883,6 +3884,7 @@ dissect_attrs (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
ti = proto_tree_add_item (attr_tree, hf_docsis_bpkmattr_cm_id, tvb, pos, length, ENC_NA);
attr_subtree = proto_item_add_subtree(ti, ett_docsis_bpkmattr_cmid);
attr_tvb = tvb_new_subset_length (tvb, pos, length);
+ // We recurse here, but we're limited by our packet length and the depth check in proto_tree_add_node.
dissect_attrs (attr_tvb, pinfo, attr_subtree);
break;
case BPKM_DISPLAY_STR:
diff --git a/epan/dissectors/packet-dof.c b/epan/dissectors/packet-dof.c
index d1075a2c..a8e07d5e 100644
--- a/epan/dissectors/packet-dof.c
+++ b/epan/dissectors/packet-dof.c
@@ -813,7 +813,7 @@ static int dissect_2008_16_security_13(tvbuff_t *tvb, packet_info *pinfo, proto_
static int dissect_2009_11_type_4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data);
static int dissect_2009_11_type_5(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
-static const gchar* dof_oid_create_standard_string(guint32 bufferSize, const guint8 *pOIDBuffer);
+static const gchar* dof_oid_create_standard_string(guint32 bufferSize, const guint8 *pOIDBuffer, packet_info *pinfo);
static const gchar* dof_iid_create_standard_string(guint32 bufferSize, const guint8 *pIIDBuffer);
static guint8 dof_oid_create_internal(const char *oid, guint32 *size, guint8 *buffer);
static void dof_oid_new_standard_string(const char *data, guint32 *rsize, guint8 **oid);
@@ -1340,7 +1340,7 @@ typedef struct
static oap_1_binding* oap_1_resolve_alias(oap_1_alias_key *key);
-static int oap_1_tree_add_alias(dof_api_data *api_data, oap_1_packet_data *oap_packet _U_, dof_packet_data *packet, proto_tree *tree, tvbuff_t *tvb, gint offset, guint8 alias_length, guint8 resolve)
+static int oap_1_tree_add_alias(dof_api_data *api_data, oap_1_packet_data *oap_packet _U_, dof_packet_data *packet, proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset, guint8 alias_length, guint8 resolve)
{
dof_session_data *session = api_data->session;
proto_item *ti;
@@ -1381,7 +1381,7 @@ static int oap_1_tree_add_alias(dof_api_data *api_data, oap_1_packet_data *oap_p
proto_item_set_generated(ti);
/* Decode the Object ID */
- ti = proto_tree_add_bytes_format_value(tree, hf_oap_1_objectid, tvb, 0, 0, binding->oid, "%s", dof_oid_create_standard_string(binding->oid_length, binding->oid));
+ ti = proto_tree_add_bytes_format_value(tree, hf_oap_1_objectid, tvb, 0, 0, binding->oid, "%s", dof_oid_create_standard_string(binding->oid_length, binding->oid, pinfo));
proto_item_set_generated(ti);
proto_tree_add_uint_format(options_tree, hf_oap_1_alias_frame,
@@ -3061,6 +3061,7 @@ static int dissect_2008_16_security_13(tvbuff_t *tvb, packet_info *pinfo, proto_
*
* If 'tree' is NULL then just return the length.
*/
+// NOLINTNEXTLINE(misc-no-recursion)
static gint dissect_2009_11_type_4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
proto_item *ti;
@@ -3075,7 +3076,7 @@ static gint dissect_2009_11_type_4(tvbuff_t *tvb, packet_info *pinfo, proto_tree
if (tree)
{
ti = proto_tree_get_parent(tree);
- proto_item_set_text(ti, "Object ID: %s", dof_oid_create_standard_string(tvb_reported_length(tvb), tvb_get_ptr(tvb, 0, tvb_reported_length(tvb))));
+ proto_item_set_text(ti, "Object ID: %s", dof_oid_create_standard_string(tvb_reported_length(tvb), tvb_get_ptr(tvb, 0, tvb_reported_length(tvb)), pinfo));
}
offset = read_c4(tvb, offset, &oid_class, &oid_class_len);
@@ -3120,7 +3121,9 @@ static gint dissect_2009_11_type_4(tvbuff_t *tvb, packet_info *pinfo, proto_tree
ti = proto_tree_add_item(tree, hf_oid_all_attribute_data, tvb, offset, -1, ENC_NA);
attribute_tree = proto_item_add_subtree(ti, ett_oid_attribute);
flag = tvb_get_guint8(tvb, offset);
+ increment_dissection_depth(pinfo);
attribute_length = dissect_2009_11_type_5(packet, pinfo, attribute_tree);
+ decrement_dissection_depth(pinfo);
proto_item_set_len(ti, (const gint)attribute_length);
offset += attribute_length;
}
@@ -3152,6 +3155,7 @@ static gint dissect_2009_11_type_4(tvbuff_t *tvb, packet_info *pinfo, proto_tree
*
* If 'tree' is NULL then just return the length.
*/
+// NOLINTNEXTLINE(misc-no-recursion)
static int dissect_2009_11_type_5(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item *ti;
@@ -3190,7 +3194,9 @@ static int dissect_2009_11_type_5(tvbuff_t *tvb, packet_info *pinfo, proto_tree
ti = proto_tree_add_item(tree, hf_oid_attribute_oid, tvb, offset, -1, ENC_NA);
attribute_tree = proto_item_add_subtree(ti, ett_oid_attribute_oid);
+ increment_dissection_depth(pinfo);
offset += dissect_2009_11_type_4(packet, pinfo, attribute_tree, NULL);
+ decrement_dissection_depth(pinfo);
}
break;
@@ -4084,7 +4090,8 @@ static DOFObjectID DOFObjectID_Create_Bytes(guint32 bufferSize, const guint8 *pO
return rval;
}
-static guint32 ObjectID_ToStringLength(const DOFObjectID oid)
+// NOLINTNEXTLINE(misc-no-recursion)
+static guint32 ObjectID_ToStringLength(const DOFObjectID oid, packet_info *pinfo)
{
guint32 len = 0;
@@ -4097,6 +4104,7 @@ static guint32 ObjectID_ToStringLength(const DOFObjectID oid)
len += 4; /* Four more hex digits. */
else if (DOFObjectID_GetIDClass(oid) & 0xFF00)
len += 2; /* Two more hex digits. */
+ increment_dissection_depth(pinfo);
/* Handle Attributes, if any. */
if (DOFObjectID_HasAttributes(oid))
{
@@ -4120,7 +4128,7 @@ static guint32 ObjectID_ToStringLength(const DOFObjectID oid)
DOFObjectIDAttribute_GetValue(avpDescriptor));
if (embedOID)
{
- len += ObjectID_ToStringLength(embedOID); /* Recurse to compute string rep length of found OID. */
+ len += ObjectID_ToStringLength(embedOID, pinfo); /* Recurse to compute string rep length of found OID. */
DOFObjectID_Destroy(embedOID);
}
else
@@ -4131,6 +4139,7 @@ static guint32 ObjectID_ToStringLength(const DOFObjectID oid)
}
} /* end for(). */
}
+ decrement_dissection_depth(pinfo);
return len;
}
@@ -4167,7 +4176,8 @@ static guint32 InterfaceID_ToString(const guint8 *iid, char *pBuf)
return len;
}
-static guint32 ObjectID_ToString(const DOFObjectID oid, char *pBuf)
+// NOLINTNEXTLINE(misc-no-recursion)
+static guint32 ObjectID_ToString(const DOFObjectID oid, char *pBuf, packet_info *pinfo)
{
DOFObjectIDClass oidClass;
guint32 len = 0;
@@ -4225,7 +4235,9 @@ static guint32 ObjectID_ToString(const DOFObjectID oid, char *pBuf)
DOFObjectIDAttribute_GetValue(avpDescriptor));
if (embedOID)
{
- len += ObjectID_ToString(embedOID, &pBuf[len]); /* Recurse to output string rep of found OID. */
+ increment_dissection_depth(pinfo);
+ len += ObjectID_ToString(embedOID, &pBuf[len], pinfo); /* Recurse to output string rep of found OID. */
+ decrement_dissection_depth(pinfo);
DOFObjectID_Destroy(embedOID);
}
else
@@ -4257,7 +4269,7 @@ static const gchar* dof_iid_create_standard_string(guint32 bufferSize, const gui
return pRetval;
}
-static const gchar* dof_oid_create_standard_string(guint32 bufferSize, const guint8 *pOIDBuffer)
+static const gchar* dof_oid_create_standard_string(guint32 bufferSize, const guint8 *pOIDBuffer, packet_info *pinfo)
{
DOFObjectID oid;
gchar *pRetval;
@@ -4267,12 +4279,12 @@ static const gchar* dof_oid_create_standard_string(guint32 bufferSize, const gui
if (!oid)
return "Illegal OID";
- len = ObjectID_ToStringLength(oid);
+ len = ObjectID_ToStringLength(oid, pinfo);
/* Use PCRMem_Alloc() and not DOFMem_Alloc() because app caller will be freeing memory with PCRMem_Destroy(). */
pRetval = (gchar *)wmem_alloc(wmem_packet_scope(), len + 1);
if (pRetval)
{
- ObjectID_ToString(oid, pRetval);
+ ObjectID_ToString(oid, pRetval, pinfo);
pRetval[len] = 0;
}
@@ -4287,6 +4299,7 @@ struct parseCtx
guint32 oidLen;
guint32 currOidPos;
guint32 currBufferPos;
+ unsigned depth;
}parseCtx;
/* Operations on OID string */
@@ -4537,22 +4550,29 @@ static guint8 parseAttributeID(struct parseCtx *ctx)
return 1;
}
+// NOLINTNEXTLINE(misc-no-recursion)
static guint8 parseAttributeData(struct parseCtx *ctx)
{
+ uint8_t ret;
+ ctx->depth++;
+ DISSECTOR_ASSERT(ctx->depth < prefs.gui_max_tree_depth);
if (PARSECTX_PEEK_CHAR_OID(ctx) == '[')
{
- return parseFormatOID(ctx);
+ ret = parseFormatOID(ctx);
}
else if (PARSECTX_PEEK_CHAR_OID(ctx) == '{')
{
- return parseHexField(ctx);
+ ret = parseHexField(ctx);
}
else
{
- return parseStringField(ctx);
+ ret = parseStringField(ctx);
}
+ ctx->depth--;
+ return ret;
}
+// NOLINTNEXTLINE(misc-no-recursion)
static guint8 parseAttribute(struct parseCtx *ctx)
{
if (parseAttributeID(ctx) == 0)
@@ -4603,6 +4623,7 @@ static guint8 parseAttributes(struct parseCtx *ctx)
return 1;
}
+// NOLINTNEXTLINE(misc-no-recursion)
static guint8 parseFormatOID(struct parseCtx *ctx)
{
/* oid must start with '[' */
@@ -4658,12 +4679,10 @@ static guint8 parseFormatOID(struct parseCtx *ctx)
static guint8 dof_oid_create_internal(const char *oid, guint32 *size, guint8 *buffer)
{
- struct parseCtx ctx;
+ struct parseCtx ctx = {0};
ctx.oid = oid;
ctx.buffer = buffer;
- ctx.currOidPos = 0;
- ctx.currBufferPos = 0;
if (oid)
{
@@ -6765,7 +6784,7 @@ static int dissect_dpp_2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo
if (packet_data->sender_sid)
{
- const gchar *SID = dof_oid_create_standard_string(packet_data->sender_sid[0], packet_data->sender_sid + 1);
+ const gchar *SID = dof_oid_create_standard_string(packet_data->sender_sid[0], packet_data->sender_sid + 1, pinfo);
ti = proto_tree_add_bytes_format_value(tree, hf_2008_1_dpp_sid_str, tvb, 0, 0, packet_data->sender_sid, "%s", SID);
proto_item_set_generated(ti);
}
@@ -6776,7 +6795,7 @@ static int dissect_dpp_2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo
if (packet_data->receiver_sid)
{
- const gchar *SID = dof_oid_create_standard_string(packet_data->receiver_sid[0], packet_data->receiver_sid + 1);
+ const gchar *SID = dof_oid_create_standard_string(packet_data->receiver_sid[0], packet_data->receiver_sid + 1, pinfo);
ti = proto_tree_add_bytes_format_value(tree, hf_2008_1_dpp_rid_str, tvb, 0, 0, packet_data->receiver_sid, "%s", SID);
proto_item_set_generated(ti);
}
@@ -8313,7 +8332,7 @@ static int dissect_oap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
expert_add_info(pinfo, ti, &ei_oap_no_session);
return offset;
}
- offset = oap_1_tree_add_alias(api_data, oap_packet, packet_data, oap_tree, tvb, offset, alias_len, TRUE);
+ offset = oap_1_tree_add_alias(api_data, oap_packet, packet_data, oap_tree, tvb, pinfo, offset, alias_len, TRUE);
}
else
offset = oap_1_tree_add_binding(oap_tree, pinfo, tvb, offset);
@@ -8356,7 +8375,7 @@ static int dissect_oap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
expert_add_info(pinfo, ti, &ei_oap_no_session);
return offset;
}
- offset = oap_1_tree_add_alias(api_data, oap_packet, packet_data, oap_tree, tvb, offset, alias_len, TRUE);
+ offset = oap_1_tree_add_alias(api_data, oap_packet, packet_data, oap_tree, tvb, pinfo, offset, alias_len, TRUE);
}
else
offset = oap_1_tree_add_binding(oap_tree, pinfo, tvb, offset);
@@ -8392,7 +8411,7 @@ static int dissect_oap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
expert_add_info(pinfo, ti, &ei_oap_no_session);
return offset;
}
- offset = oap_1_tree_add_alias(api_data, oap_packet, packet_data, oap_tree, tvb, offset, alias_len, TRUE);
+ offset = oap_1_tree_add_alias(api_data, oap_packet, packet_data, oap_tree, tvb, pinfo, offset, alias_len, TRUE);
}
else
offset = oap_1_tree_add_binding(oap_tree, pinfo, tvb, offset);
@@ -8429,7 +8448,7 @@ static int dissect_oap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
expert_add_info(pinfo, ti, &ei_oap_no_session);
return offset;
}
- offset = oap_1_tree_add_alias(api_data, oap_packet, packet_data, oap_tree, tvb, offset, alias_len, TRUE);
+ offset = oap_1_tree_add_alias(api_data, oap_packet, packet_data, oap_tree, tvb, pinfo, offset, alias_len, TRUE);
}
else
offset = oap_1_tree_add_binding(oap_tree, pinfo, tvb, offset);
@@ -8455,7 +8474,7 @@ static int dissect_oap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
expert_add_info(pinfo, ti, &ei_oap_no_session);
return offset;
}
- offset = oap_1_tree_add_alias(api_data, oap_packet, packet_data, oap_tree, tvb, offset, alias_len, TRUE);
+ offset = oap_1_tree_add_alias(api_data, oap_packet, packet_data, oap_tree, tvb, pinfo, offset, alias_len, TRUE);
}
else
offset = oap_1_tree_add_binding(oap_tree, pinfo, tvb, offset);
@@ -8488,7 +8507,7 @@ static int dissect_oap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
expert_add_info(pinfo, ti, &ei_oap_no_session);
return offset;
}
- offset = oap_1_tree_add_alias(api_data, oap_packet, packet_data, oap_tree, tvb, offset, alias_length, FALSE);
+ offset = oap_1_tree_add_alias(api_data, oap_packet, packet_data, oap_tree, tvb, pinfo, offset, alias_length, FALSE);
iid_offset = offset;
offset = oap_1_tree_add_interface(oap_tree, tvb, offset);
@@ -8546,7 +8565,7 @@ static int dissect_oap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
expert_add_info(pinfo, ti, &ei_oap_no_session);
return offset;
}
- offset = oap_1_tree_add_alias(api_data, oap_packet, packet_data, oap_tree, tvb, offset, alias_len, TRUE);
+ offset = oap_1_tree_add_alias(api_data, oap_packet, packet_data, oap_tree, tvb, pinfo, offset, alias_len, TRUE);
}
else
offset = oap_1_tree_add_binding(oap_tree, pinfo, tvb, offset);
diff --git a/epan/dissectors/packet-dvb-s2-bb.c b/epan/dissectors/packet-dvb-s2-bb.c
index 3f603b20..f1ee9b15 100644
--- a/epan/dissectors/packet-dvb-s2-bb.c
+++ b/epan/dissectors/packet-dvb-s2-bb.c
@@ -1310,7 +1310,7 @@ static int dissect_dvb_s2_gse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
next_tvb = process_reassembled_data(tvb, new_off, pinfo, "Reassembled GSE",
dvbs2_frag_head, &dvb_s2_gse_frag_items, &update_col_info, tree);
- if (next_tvb != NULL) {
+ if (next_tvb != NULL && subpacket_data) {
/* We have a reassembled packet. */
complete = TRUE;
labeltype = subpacket_data->labeltype;
diff --git a/epan/dissectors/packet-e2ap.c b/epan/dissectors/packet-e2ap.c
index 19069a79..e1952aba 100644
--- a/epan/dissectors/packet-e2ap.c
+++ b/epan/dissectors/packet-e2ap.c
@@ -2100,7 +2100,6 @@ static int dissect_e2ap_RANParameter_Definition(tvbuff_t *tvb _U_, int offset _U
static int dissect_e2ap_RANParameter_ValueType(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
-#define MAX_RECURSION_DEPTH 100 // Arbitrarily chosen.
static const value_string e2ap_Criticality_vals[] = {
{ 0, "reject" },
@@ -7286,15 +7285,14 @@ static const per_sequence_t RANParameter_Testing_Item_sequence[] = {
static int
dissect_e2ap_RANParameter_Testing_Item(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 5;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // RANParameter-Testing-Item → RANParameter-Testing-Item/ranParameter-Type → RANParameter-Testing-Item-Choice-List → RANParameter-Testing-LIST → RANParameter-Testing-Item
+ actx->pinfo->dissection_depth += 4;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
ett_e2ap_RANParameter_Testing_Item, RANParameter_Testing_Item_sequence);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 4;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
@@ -7679,15 +7677,14 @@ static const per_sequence_t RANParameter_Definition_sequence[] = {
static int
dissect_e2ap_RANParameter_Definition(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 6;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // RANParameter-Definition → RANParameter-Definition-Choice → RANParameter-Definition-Choice-LIST → RANParameter-Definition-Choice-LIST/ranParameter-List → RANParameter-Definition-Choice-LIST-Item → RANParameter-Definition
+ actx->pinfo->dissection_depth += 5;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
ett_e2ap_RANParameter_Definition, RANParameter_Definition_sequence);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 5;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
@@ -7837,16 +7834,15 @@ static const per_choice_t RANParameter_ValueType_choice[] = {
static int
dissect_e2ap_RANParameter_ValueType(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 6;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // RANParameter-ValueType → RANParameter-ValueType-Choice-Structure → RANParameter-STRUCTURE → RANParameter-STRUCTURE/sequence-of-ranParameters → RANParameter-STRUCTURE-Item → RANParameter-ValueType
+ actx->pinfo->dissection_depth += 5;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
ett_e2ap_RANParameter_ValueType, RANParameter_ValueType_choice,
NULL);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 5;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
diff --git a/epan/dissectors/packet-edonkey.c b/epan/dissectors/packet-edonkey.c
index 3cb1a64f..8e338abe 100644
--- a/epan/dissectors/packet-edonkey.c
+++ b/epan/dissectors/packet-edonkey.c
@@ -1653,6 +1653,7 @@ static int dissect_kademlia2_peer(tvbuff_t *tvb, packet_info *pinfo,
/* Dissects the eDonkey search query */
+// NOLINTNEXTLINE(misc-no-recursion)
static int dissect_edonkey_search_query(tvbuff_t *tvb, packet_info *pinfo,
int offset, proto_tree *tree)
{
@@ -1668,6 +1669,7 @@ static int dissect_edonkey_search_query(tvbuff_t *tvb, packet_info *pinfo,
search_length = 1;
ti = proto_tree_add_uint(tree, hf_edonkey_search_type, tvb, offset, 1, search_type);
+ increment_dissection_depth(pinfo);
switch (search_type)
{
case EDONKEY_SEARCH_BOOL:
@@ -1752,6 +1754,7 @@ static int dissect_edonkey_search_query(tvbuff_t *tvb, packet_info *pinfo,
offset += search_length;
break;
}
+ decrement_dissection_depth(pinfo);
return offset;
}
@@ -2507,6 +2510,7 @@ static int dissect_kademlia_search_result(tvbuff_t *tvb, packet_info *pinfo,
return dissect_kademlia_taglist( tvb, pinfo, offset, tree );
}
+// NOLINTNEXTLINE(misc-no-recursion)
static int dissect_kademlia_search_expression_tree(tvbuff_t *tvb, packet_info *pinfo,
int offset, proto_tree *tree)
{
@@ -2518,6 +2522,7 @@ static int dissect_kademlia_search_expression_tree(tvbuff_t *tvb, packet_info *p
ti = proto_tree_add_uint(tree, hf_kademlia_search_expression_type, tvb, offset, 1, op);
tree = proto_item_add_subtree( ti, ett_kademlia_search_expression );
++offset;
+ increment_dissection_depth(pinfo);
switch( op ) {
case 0: /* Bool op */
proto_tree_add_item(tree, hf_kademlia_search_bool_op, tvb, offset, 1, ENC_NA );
@@ -2553,6 +2558,7 @@ static int dissect_kademlia_search_expression_tree(tvbuff_t *tvb, packet_info *p
default:
expert_add_info_format(pinfo, ti, &ei_kademlia_search_expression_type, "NOT DECODED op %x", op );
}
+ decrement_dissection_depth(pinfo);
proto_item_set_len( ti, offset - item_start_offset );
return offset;
}
diff --git a/epan/dissectors/packet-enrp.c b/epan/dissectors/packet-enrp.c
index 2611e12a..70114dcc 100644
--- a/epan/dissectors/packet-enrp.c
+++ b/epan/dissectors/packet-enrp.c
@@ -102,6 +102,7 @@ static guint64 enrp_total_msgs = 0;
static guint64 enrp_total_bytes = 0;
static expert_field ei_enrp_max_recursion_depth_reached = EI_INIT;
+static expert_field ei_enrp_invalid_length = EI_INIT;
static void
dissect_parameters(tvbuff_t *, packet_info *, proto_tree *);
@@ -114,6 +115,7 @@ dissect_enrp(tvbuff_t *, packet_info *, proto_tree *, void*);
#define ENRP_UDP_PORT 9901
#define ENRP_SCTP_PORT 9901
+#define ENRP_MAX_RECURSION_DEPTH 10
typedef struct _enrp_tap_rec_t {
guint8 type;
@@ -137,6 +139,7 @@ dissect_unknown_cause(tvbuff_t *cause_tvb, proto_tree *cause_tree, proto_item *c
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_error_cause(tvbuff_t *cause_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
guint16 code, length, padding_length;
@@ -194,6 +197,7 @@ dissect_error_cause(tvbuff_t *cause_tvb, packet_info *pinfo, proto_tree *paramet
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_error_causes(tvbuff_t *error_causes_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
guint16 length, total_length;
@@ -203,6 +207,12 @@ dissect_error_causes(tvbuff_t *error_causes_tvb, packet_info *pinfo, proto_tree
offset = 0;
while(tvb_reported_length_remaining(error_causes_tvb, offset) > 0) {
length = tvb_get_ntohs(error_causes_tvb, offset + CAUSE_LENGTH_OFFSET);
+ if (length < 4) {
+ proto_tree_add_expert_format(parameter_tree, pinfo, &ei_enrp_invalid_length,
+ error_causes_tvb, offset + CAUSE_LENGTH_OFFSET, 2,
+ "Error cause length must be at least 4 bytes");
+ return;
+ }
total_length = WS_ROUNDUP_4(length);
error_cause_tvb = tvb_new_subset_length(error_causes_tvb, offset, total_length);
dissect_error_cause(error_cause_tvb, pinfo, parameter_tree);
@@ -227,6 +237,7 @@ dissect_ipv6_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_dccp_transport_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@@ -240,6 +251,7 @@ dissect_dccp_transport_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, pr
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_sctp_transport_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@@ -252,6 +264,7 @@ dissect_sctp_transport_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, pr
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_tcp_transport_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@@ -264,6 +277,7 @@ dissect_tcp_transport_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, pro
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_udp_transport_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@@ -276,6 +290,7 @@ dissect_udp_transport_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, pro
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_udp_lite_transport_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@@ -360,6 +375,7 @@ dissect_pool_handle_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_pool_element_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t* parameters_tvb;
@@ -373,6 +389,7 @@ dissect_pool_element_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, prot
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_server_information_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@@ -384,6 +401,7 @@ dissect_server_information_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_operation_error_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *error_causes_tvb;
@@ -432,12 +450,22 @@ dissect_unknown_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, p
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *enrp_tree)
{
guint16 type, length, padding_length;
proto_tree *parameter_item;
proto_tree *parameter_tree;
+ unsigned recursion_depth = p_get_proto_depth(pinfo, proto_enrp);
+
+ if (recursion_depth > ENRP_MAX_RECURSION_DEPTH) {
+ proto_tree_add_expert(enrp_tree, pinfo, &ei_enrp_max_recursion_depth_reached,
+ parameter_tvb, 0, 0);
+ return;
+ }
+ p_set_proto_depth(pinfo, proto_enrp, recursion_depth + 1);
+
/* extract tag and length from the parameter */
type = tvb_get_ntohs(parameter_tvb, PARAMETER_TYPE_OFFSET);
length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET);
@@ -504,9 +532,12 @@ dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *enrp_
if (padding_length > 0)
proto_tree_add_item(parameter_tree, hf_parameter_padding, parameter_tvb, PARAMETER_HEADER_OFFSET + length, padding_length, ENC_NA);
+
+ p_set_proto_depth(pinfo, proto_enrp, recursion_depth);
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_parameters(tvbuff_t *parameters_tvb, packet_info *pinfo, proto_tree *tree)
{
gint offset, length, total_length, remaining_length;
@@ -515,6 +546,11 @@ dissect_parameters(tvbuff_t *parameters_tvb, packet_info *pinfo, proto_tree *tre
offset = 0;
while((remaining_length = tvb_reported_length_remaining(parameters_tvb, offset)) > 0) {
length = tvb_get_ntohs(parameters_tvb, offset + PARAMETER_LENGTH_OFFSET);
+ if (length < 4) {
+ proto_tree_add_expert(tree, pinfo, &ei_enrp_invalid_length,
+ parameters_tvb, offset + PARAMETER_LENGTH_OFFSET, 2);
+ return;
+ }
total_length = WS_ROUNDUP_4(length);
if (remaining_length >= length)
total_length = MIN(total_length, remaining_length);
@@ -543,6 +579,7 @@ static const true_false_string reply_required_bit_value = {
};
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_enrp_presence_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *message_tree, proto_tree *flags_tree)
{
tvbuff_t *parameters_tvb;
@@ -585,6 +622,7 @@ static const true_false_string more_to_send_bit_value = {
};
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_enrp_handle_table_response_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *message_tree, proto_tree *flags_tree)
{
tvbuff_t *parameters_tvb;
@@ -617,6 +655,7 @@ static const true_false_string tos_bit_value = {
};
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_enrp_handle_update_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *message_tree, proto_tree *flags_tree)
{
tvbuff_t *parameters_tvb;
@@ -639,6 +678,7 @@ dissect_enrp_list_request_message(tvbuff_t *message_tvb, packet_info *pinfo _U_,
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_enrp_list_response_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *message_tree, proto_tree *flags_tree)
{
tvbuff_t *parameters_tvb;
@@ -681,6 +721,7 @@ dissect_enrp_init_takeover_server_message(tvbuff_t *message_tvb, packet_info *pi
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_enrp_error_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *message_tree, proto_tree *flags_tree _U_)
{
tvbuff_t *parameters_tvb;
@@ -722,6 +763,7 @@ static const value_string message_type_values[] = {
{ 0, NULL } };
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_enrp_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *enrp_tree)
{
enrp_tap_rec_t *tap_rec;
@@ -783,21 +825,20 @@ dissect_enrp_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *enrp
}
}
-#define ENRP_MAX_RECURSION_DEPTH 10
-
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_enrp_main(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree)
{
proto_item *enrp_item;
proto_tree *enrp_tree;
unsigned recursion_depth = p_get_proto_depth(pinfo, proto_enrp);
- if (++recursion_depth >= ENRP_MAX_RECURSION_DEPTH) {
+ if (recursion_depth > ENRP_MAX_RECURSION_DEPTH) {
proto_tree_add_expert(tree, pinfo, &ei_enrp_max_recursion_depth_reached,
message_tvb, 0, 0);
return;
}
- p_set_proto_depth(pinfo, proto_enrp, recursion_depth);
+ p_set_proto_depth(pinfo, proto_enrp, recursion_depth + 1);
/* create the enrp protocol tree */
enrp_item = proto_tree_add_item(tree, proto_enrp, message_tvb, 0, -1, ENC_NA);
@@ -1111,7 +1152,9 @@ proto_register_enrp(void)
static ei_register_info ei[] = {
{ &ei_enrp_max_recursion_depth_reached, { "enrp.max_recursion_depth_reached",
- PI_PROTOCOL, PI_WARN, "Maximum allowed recursion depth reached - stop decoding", EXPFILL }}
+ PI_PROTOCOL, PI_WARN, "Maximum allowed recursion depth reached - stop decoding", EXPFILL }},
+ { &ei_enrp_invalid_length, { "enrp.invalid_length",
+ PI_MALFORMED, PI_ERROR, "Parameter length must be at least 4 bytes", EXPFILL }}
};
static tap_param enrp_stat_params[] = {
diff --git a/epan/dissectors/packet-erldp.c b/epan/dissectors/packet-erldp.c
index dcf50527..b44f333b 100644
--- a/epan/dissectors/packet-erldp.c
+++ b/epan/dissectors/packet-erldp.c
@@ -354,6 +354,7 @@ static gint dissect_etf_dist_header(packet_info *pinfo _U_, tvbuff_t *tvb, gint
return offset;
}
+// NOLINTNEXTLINE(misc-no-recursion)
static gint dissect_etf_tuple_content(gboolean large, packet_info *pinfo, tvbuff_t *tvb, gint offset, proto_tree *tree, const gchar **value_str _U_) {
guint32 arity, i;
@@ -415,12 +416,15 @@ static gint dissect_etf_big_ext(tvbuff_t *tvb, gint offset, guint32 len, proto_t
return offset + len;
}
+// NOLINTNEXTLINE(misc-no-recursion)
static gint dissect_etf_type_content(guint8 tag, packet_info *pinfo, tvbuff_t *tvb, gint offset, proto_tree *tree, const gchar **value_str) {
gint32 int_val;
guint32 len, i, uint_val;
guint32 id;
const guint8 *str_val;
+ increment_dissection_depth(pinfo);
+
switch (tag) {
case ATOM_CACHE_REF:
proto_tree_add_item_ret_uint(tree, hf_erldp_atom_cache_ref, tvb, offset, 1, ENC_BIG_ENDIAN, &uint_val);
@@ -623,6 +627,8 @@ static gint dissect_etf_type_content(guint8 tag, packet_info *pinfo, tvbuff_t *t
break;
}
+ decrement_dissection_depth(pinfo);
+
return offset;
}
@@ -737,6 +743,7 @@ static gint dissect_etf_versioned_type(const gchar *label, packet_info *pinfo, t
return dissect_etf_type(label, pinfo, tvb, offset, tree);
}
+// NOLINTNEXTLINE(misc-no-recursion)
static gint dissect_etf_type(const gchar *label, packet_info *pinfo, tvbuff_t *tvb, gint offset, proto_tree *tree) {
gint begin = offset;
guint32 tag;
diff --git a/epan/dissectors/packet-etch.c b/epan/dissectors/packet-etch.c
index a651fdab..8d9b1919 100644
--- a/epan/dissectors/packet-etch.c
+++ b/epan/dissectors/packet-etch.c
@@ -139,11 +139,11 @@ static gboolean gbl_have_symbol = FALSE;
* forward declared dissector methods
*/
static void read_key_value(unsigned int *offset, tvbuff_t *tvb,
- proto_tree *etch_tree);
+ proto_tree *etch_tree, packet_info *pinfo);
static void read_struct(unsigned int *offset, tvbuff_t *tvb,
- proto_tree *etch_tree, int add_type_field);
+ proto_tree *etch_tree, packet_info *pinfo, int add_type_field);
static int read_value(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree,
- int asWhat);
+ packet_info *pinfo, int asWhat);
/************************************************************************
* Symbol value-string functions
@@ -440,7 +440,8 @@ read_length(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree)
* read an array from tvb and add it to tree
*/
static void
-read_array(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree)
+// NOLINTNEXTLINE(misc-no-recursion)
+read_array(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree, packet_info *pinfo)
{
int length;
@@ -458,7 +459,7 @@ read_array(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree)
length = read_length(offset, tvb, etch_tree);
for (; length > 0; length--) {
- read_value(offset, tvb, etch_tree, hf_etch_value);
+ read_value(offset, tvb, etch_tree, pinfo, hf_etch_value);
}
/* terminaton */
read_type(offset, tvb, etch_tree);
@@ -536,8 +537,9 @@ read_number(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree,
* read a value and add it to tree
*/
static int
+// NOLINTNEXTLINE(misc-no-recursion)
read_value(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree,
- int asWhat)
+ packet_info *pinfo, int asWhat)
{
guint8 type_code;
@@ -550,12 +552,13 @@ read_value(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree,
return type_code;
}
+ increment_dissection_depth(pinfo);
switch(type_code) {
case ETCH_TC_CUSTOM:
- read_struct(offset, tvb, etch_tree, 1);
+ read_struct(offset, tvb, etch_tree, pinfo, 1);
break;
case ETCH_TC_ARRAY:
- read_array(offset, tvb, etch_tree);
+ read_array(offset, tvb, etch_tree, pinfo);
break;
case ETCH_TC_STRING:
read_string(offset, tvb, etch_tree);
@@ -584,6 +587,7 @@ read_value(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree,
default:
read_number(offset, tvb, etch_tree, asWhat, type_code);
}
+ decrement_dissection_depth(pinfo);
return 0;
}
@@ -592,7 +596,7 @@ read_value(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree,
*/
static void
read_struct(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree,
- int add_type_field)
+ packet_info *pinfo, int add_type_field)
{
proto_item *ti;
proto_tree *new_tree;
@@ -607,13 +611,13 @@ read_struct(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree,
read_type(offset, tvb, new_tree);
}
/* struct type as hash */
- read_value(offset, tvb, new_tree, hf_etch_value);
+ read_value(offset, tvb, new_tree, pinfo, hf_etch_value);
/* struct length */
- length = read_value(offset, tvb, new_tree, hf_etch_length);
+ length = read_value(offset, tvb, new_tree, pinfo, hf_etch_length);
for (i = 0; i < length; i++) {
- read_key_value(offset, tvb, new_tree);
+ read_key_value(offset, tvb, new_tree, pinfo);
}
/* termination */
@@ -624,7 +628,8 @@ read_struct(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree,
* read a key value pair and add it to tree
*/
static void
-read_key_value(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree)
+// NOLINTNEXTLINE(misc-no-recursion)
+read_key_value(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree, packet_info *pinfo)
{
proto_tree *new_tree;
proto_tree *new_tree_bck;
@@ -641,7 +646,7 @@ read_key_value(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree)
ti = proto_tree_add_item(new_tree, hf_etch_keyname, tvb, *offset, 0,
ENC_NA);
new_tree = proto_item_add_subtree(ti, ett_etch_key);
- read_value(offset, tvb, new_tree, hf_etch_value);
+ read_value(offset, tvb, new_tree, pinfo, hf_etch_value);
/* append the symbol of the key */
if(gbl_have_symbol == TRUE){
@@ -651,7 +656,7 @@ read_key_value(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree)
ti = proto_tree_add_item(new_tree_bck, hf_etch_valuename, tvb, *offset,
0, ENC_NA);
new_tree = proto_item_add_subtree(ti, ett_etch_value);
- read_value(offset, tvb, new_tree, hf_etch_value);
+ read_value(offset, tvb, new_tree, pinfo, hf_etch_value);
}
/*************************************************************************/
@@ -731,7 +736,7 @@ dissect_etch_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
proto_tree_add_item(etch_tree, hf_etch_sig, tvb, 0, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(etch_tree, hf_etch_length, tvb, 4, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(etch_tree, hf_etch_version, tvb, 8, 1, ENC_BIG_ENDIAN);
- read_struct(&offset, tvb, etch_tree, 0);
+ read_struct(&offset, tvb, etch_tree, pinfo, 0);
}
return tvb_captured_length(tvb);
@@ -920,10 +925,7 @@ void proto_register_etch(void)
&ett_etch_value,
};
- proto_etch = proto_register_protocol("Apache Etch Protocol", /* name */
- "Etch", /* short name */
- "etch" /* abbrev */
- );
+ proto_etch = proto_register_protocol("Apache Etch Protocol", "Etch", "etch");
proto_register_field_array(proto_etch, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
diff --git a/epan/dissectors/packet-extrememesh.c b/epan/dissectors/packet-extrememesh.c
index ca97fa9d..dedeb6b1 100644
--- a/epan/dissectors/packet-extrememesh.c
+++ b/epan/dissectors/packet-extrememesh.c
@@ -1462,6 +1462,7 @@ static gint dissect_extrememesh_probe(tvbuff_t *tvb, packet_info *pinfo, proto_t
return MESH_NEXT_PROTOCOL_INVALID;
}
+// NOLINTNEXTLINE(misc-no-recursion)
static gint dissect_extrememesh_mch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
proto_tree *meshTree = tree;
@@ -1514,6 +1515,7 @@ static gint dissect_extrememesh_mch(tvbuff_t *tvb, packet_info *pinfo, proto_tre
next_proto = MESH_NEXT_PROTOCOL_INVALID;
break;
case MESH_NEXT_PROTOCOL_MCH:
+ // We recurse here, but we'll run out of packet before we run out of stack.
next_proto = dissect_extrememesh_mch(nextTvb, pinfo, meshTree);
break;
case MESH_NEXT_PROTOCOL_ENCAPSULATED_ETH:
diff --git a/epan/dissectors/packet-fcswils.c b/epan/dissectors/packet-fcswils.c
index e9fb3e70..904c5aa0 100644
--- a/epan/dissectors/packet-fcswils.c
+++ b/epan/dissectors/packet-fcswils.c
@@ -1207,6 +1207,7 @@ dissect_swils_zone_mbr(tvbuff_t *tvb, packet_info* pinfo, proto_tree *zmbr_tree,
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_swils_zone_obj(tvbuff_t *tvb, packet_info* pinfo, proto_tree *zobj_tree, int offset)
{
proto_tree *zmbr_tree;
@@ -1229,6 +1230,7 @@ dissect_swils_zone_obj(tvbuff_t *tvb, packet_info* pinfo, proto_tree *zobj_tree,
offset += 8 + ZONENAME_LEN(tvb, offset+4);
for (i = 0; i < numrec; i++) {
if (objtype == FC_SWILS_ZONEOBJ_ZONESET) {
+ // We recurse here, but we'll run out of packet before we run out of stack.
dissect_swils_zone_obj(tvb, pinfo, zobj_tree, offset);
offset += get_zoneobj_len(tvb, offset);
}
diff --git a/epan/dissectors/packet-geonw.c b/epan/dissectors/packet-geonw.c
index 34059574..77d7e282 100644
--- a/epan/dissectors/packet-geonw.c
+++ b/epan/dissectors/packet-geonw.c
@@ -1742,6 +1742,7 @@ static int dissect_sec_signer_info(tvbuff_t *tvb, gint *offset, packet_info *pin
static int hf_sgeonw_certification_version = -1;
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_sec_certificate(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tree, guint8 version)
{
guint32 tmp_val;
@@ -1777,6 +1778,7 @@ dissect_sec_certificate(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_t
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_sec_signer_info(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_tree *tree, guint8 version)
{
gint start = *offset;
@@ -1787,6 +1789,8 @@ dissect_sec_signer_info(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_t
proto_item *tinner;
proto_tree *insidetree;
+ increment_dissection_depth(pinfo);
+
tmp_val = tvb_get_guint8(tvb, *offset);
if (tmp_val == self) {
// No additional data shall be given
@@ -1836,6 +1840,7 @@ dissect_sec_signer_info(tvbuff_t *tvb, gint *offset, packet_info *pinfo, proto_t
}
proto_item_set_end(ti, tvb, *offset);
}
+ decrement_dissection_depth(pinfo);
return (*offset) - start;
}
diff --git a/epan/dissectors/packet-giop.c b/epan/dissectors/packet-giop.c
index fd5c72ec..9e1c7325 100644
--- a/epan/dissectors/packet-giop.c
+++ b/epan/dissectors/packet-giop.c
@@ -2183,6 +2183,7 @@ static void set_new_alignment(int *offset, int delta, int alignment) {
*
* data_name is allowed to be NULL or empty string
*/
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_data_for_typecode_with_params(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_item *item, gint *offset,
gboolean stream_is_big_endian, guint32 boundary,
@@ -2220,11 +2221,11 @@ static void dissect_data_for_typecode_with_params(tvbuff_t *tvb, packet_info *pi
const gchar *buf = NULL; /* ptr to string buffer */
unsigned recursion_depth = p_get_proto_depth(pinfo, proto_giop);
- if (++recursion_depth >= GIOP_MAX_RECURSION_DEPTH) {
+ if (recursion_depth > GIOP_MAX_RECURSION_DEPTH) {
proto_tree_add_expert(tree, pinfo, &ei_giop_max_recursion_depth_reached, tvb, 0, 0);
return;
}
- p_set_proto_depth(pinfo, proto_giop, recursion_depth);
+ p_set_proto_depth(pinfo, proto_giop, recursion_depth + 1);
/* Grab the data according to data type */
@@ -2483,7 +2484,7 @@ static void dissect_data_for_typecode_with_params(tvbuff_t *tvb, packet_info *pi
expert_add_info_format(pinfo, item, &ei_giop_unknown_typecode_datatype, "Unknown typecode data type %u", data_type);
break;
}
- p_set_proto_depth(pinfo, proto_giop, recursion_depth - 1);
+ p_set_proto_depth(pinfo, proto_giop, recursion_depth);
}
/*
@@ -2546,6 +2547,7 @@ static void dissect_tk_objref_params(tvbuff_t *tvb, proto_tree *tree, gint *offs
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_tk_struct_params(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *offset,
gboolean stream_is_big_endian, guint32 boundary,
MessageHeader * header, wmem_list_t *params) {
@@ -2606,6 +2608,7 @@ static void dissect_tk_struct_params(tvbuff_t *tvb, packet_info *pinfo, proto_tr
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_tk_union_params(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item* item,
gint *offset, gboolean stream_is_big_endian, guint32 boundary,
MessageHeader * header) {
@@ -2716,6 +2719,7 @@ static void dissect_tk_enum_params(tvbuff_t *tvb, proto_tree *tree, gint *offset
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_tk_sequence_params(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *offset,
gboolean stream_is_big_endian, guint32 boundary,
MessageHeader * header, wmem_list_t *params) {
@@ -2748,6 +2752,7 @@ static void dissect_tk_sequence_params(tvbuff_t *tvb, packet_info *pinfo, proto_
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_tk_array_params(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *offset,
gboolean stream_is_big_endian, guint32 boundary,
MessageHeader * header, wmem_list_t *params) {
@@ -2787,6 +2792,7 @@ static void dissect_tk_array_params(tvbuff_t *tvb, packet_info *pinfo, proto_tre
* dissection of nested (complex) types. Those are saved into a nested linked
* list which can be handed into dissect_data_for_typecode_with_params
*/
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_tk_alias_params(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *offset,
gboolean stream_is_big_endian, guint32 boundary,
MessageHeader * header, wmem_list_t *params) {
@@ -2822,6 +2828,7 @@ static void dissect_tk_alias_params(tvbuff_t *tvb, packet_info *pinfo, proto_tre
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_tk_except_params(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *offset,
gboolean stream_is_big_endian, guint32 boundary,
MessageHeader * header) {
@@ -2868,6 +2875,7 @@ static void dissect_tk_except_params(tvbuff_t *tvb, packet_info *pinfo, proto_tr
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_tk_value_params(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *offset,
gboolean stream_is_big_endian, guint32 boundary,
MessageHeader * header) {
@@ -2928,6 +2936,7 @@ static void dissect_tk_value_params(tvbuff_t *tvb, packet_info *pinfo, proto_tre
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_tk_value_box_params(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *offset,
gboolean stream_is_big_endian, guint32 boundary,
MessageHeader * header) {
@@ -3087,6 +3096,7 @@ guint32 get_CDR_encap_info(tvbuff_t *tvb, proto_tree *tree, gint *offset,
* followed by the encoded value.
*/
+// NOLINTNEXTLINE(misc-no-recursion)
void get_CDR_any(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *item,
gint *offset, gboolean stream_is_big_endian, int boundary,
MessageHeader * header ) {
@@ -3627,6 +3637,7 @@ guint32 get_CDR_string(tvbuff_t *tvb, const gchar **seq, int *offset, gboolean s
*
* It returns a guint32 representing a TCKind value.
*/
+// NOLINTNEXTLINE(misc-no-recursion)
guint32 get_CDR_typeCode(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree,
gint *offset, gboolean stream_is_big_endian,
int boundary, MessageHeader * header ) {
@@ -3638,6 +3649,7 @@ guint32 get_CDR_typeCode(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree,
}
+// NOLINTNEXTLINE(misc-no-recursion)
static guint32 get_CDR_typeCode_with_params(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree,
gint *offset, gboolean stream_is_big_endian,
int boundary, MessageHeader * header,
@@ -3650,6 +3662,14 @@ static guint32 get_CDR_typeCode_with_params(tvbuff_t *tvb, packet_info* pinfo, p
proto_item *ti;
val = get_CDR_ulong(tvb, offset, stream_is_big_endian, boundary); /* get TCKind enum */
+
+ unsigned recursion_depth = p_get_proto_depth(pinfo, proto_giop);
+ if (recursion_depth > GIOP_MAX_RECURSION_DEPTH) {
+ proto_tree_add_expert(tree, pinfo, &ei_giop_max_recursion_depth_reached, tvb, 0, 0);
+ return val;
+ }
+ p_set_proto_depth(pinfo, proto_giop, recursion_depth + 1);
+
ti = proto_tree_add_uint(tree, hf_giop_TCKind, tvb, *offset-4, 4, val);
proto_tree *params_tree = proto_tree_add_subtree(tree, tvb, *offset, -1, ett_giop_typecode_parameters, NULL, "TypeCode-Parameters");
@@ -3765,6 +3785,8 @@ static guint32 get_CDR_typeCode_with_params(tvbuff_t *tvb, packet_info* pinfo, p
break;
} /* val */
+ p_set_proto_depth(pinfo, proto_giop, recursion_depth);
+
return val;
}
diff --git a/epan/dissectors/packet-glow.c b/epan/dissectors/packet-glow.c
index 32e6ec9d..d374395c 100644
--- a/epan/dissectors/packet-glow.c
+++ b/epan/dissectors/packet-glow.c
@@ -185,7 +185,6 @@ static int dissect_glow_ElementCollection(bool implicit_tag _U_, tvbuff_t *tvb _
static int dissect_glow_Template(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
-#define MAX_RECURSION_DEPTH 100 // Arbitrarily chosen.
static int
@@ -1086,15 +1085,14 @@ dissect_glow_SEQUENCE_OF_Element(bool implicit_tag _U_, tvbuff_t *tvb _U_, int o
static int
dissect_glow_ElementCollection(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 6;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // ElementCollection → ElementCollection/_untag → Element → Node → Node/_untag → ElementCollection
+ actx->pinfo->dissection_depth += 5;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
hf_index, BER_CLASS_APP, 4, TRUE, dissect_glow_SEQUENCE_OF_Element);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 5;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
@@ -1118,15 +1116,14 @@ dissect_glow_Parameter_U(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U
static int
dissect_glow_Parameter(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 6;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // Parameter → Parameter/_untag → ElementCollection → ElementCollection/_untag → Element → Parameter
+ actx->pinfo->dissection_depth += 5;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
hf_index, BER_CLASS_APP, 1, TRUE, dissect_glow_Parameter_U);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 5;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
@@ -1176,15 +1173,14 @@ dissect_glow_Template_U(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_
static int
dissect_glow_Template(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 9;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // Template → Template/_untag → TemplateElement → Parameter → Parameter/_untag → ElementCollection → ElementCollection/_untag → Element → Template
+ actx->pinfo->dissection_depth += 8;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_tagged_type(implicit_tag, actx, tree, tvb, offset,
hf_index, BER_CLASS_APP, 24, TRUE, dissect_glow_Template_U);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 8;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
diff --git a/epan/dissectors/packet-goose.c b/epan/dissectors/packet-goose.c
index 2eb45619..b11f8a46 100644
--- a/epan/dissectors/packet-goose.c
+++ b/epan/dissectors/packet-goose.c
@@ -187,7 +187,6 @@ static gint ett_goose_Data = -1;
static int dissect_goose_Data(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
-#define MAX_RECURSION_DEPTH 100 // Arbitrarily chosen.
static int
@@ -711,16 +710,15 @@ static const ber_choice_t Data_choice[] = {
static int
dissect_goose_Data(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 3;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // Data → Data/array → Data
+ actx->pinfo->dissection_depth += 2;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_choice(actx, tree, tvb, offset,
Data_choice, hf_index, ett_goose_Data,
NULL);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 2;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
diff --git a/epan/dissectors/packet-gquic.c b/epan/dissectors/packet-gquic.c
index 36053c01..372bd405 100644
--- a/epan/dissectors/packet-gquic.c
+++ b/epan/dissectors/packet-gquic.c
@@ -1396,6 +1396,7 @@ gboolean is_gquic_unencrypt(tvbuff_t *tvb, packet_info *pinfo, guint offset, gui
}
static guint32
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_gquic_tag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *gquic_tree, guint offset, guint32 tag_number){
guint32 tag_offset_start = offset + tag_number*4*2;
guint32 tag_offset = 0, total_tag_len = 0;
@@ -1490,6 +1491,7 @@ dissect_gquic_tag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *gquic_tree, gui
scfg_tag_number = tvb_get_guint32(tvb, tag_offset_start + tag_offset, ENC_LITTLE_ENDIAN);
tag_offset += 4;
+ // We recurse here, but we're limited by tree depth checks in epan
dissect_gquic_tag(tvb, pinfo, tag_tree, tag_offset_start + tag_offset, scfg_tag_number);
tag_offset += tag_len - 4 - 4;
}
diff --git a/epan/dissectors/packet-gsm_abis_oml.c b/epan/dissectors/packet-gsm_abis_oml.c
index 43294758..0b667872 100644
--- a/epan/dissectors/packet-gsm_abis_oml.c
+++ b/epan/dissectors/packet-gsm_abis_oml.c
@@ -1567,6 +1567,7 @@ dissect_ipacc_test_rep(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb)
/* Dissect OML FOM Attributes after OML + FOM header */
static gint
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_oml_attrs(tvbuff_t *tvb, int base_offs, int length,
packet_info *pinfo, proto_tree *tree)
{
@@ -1770,7 +1771,9 @@ dissect_oml_attrs(tvbuff_t *tvb, int base_offs, int length,
tvb, loffset++, 1,
ENC_LITTLE_ENDIAN);
}
+ increment_dissection_depth(pinfo);
dissect_oml_attrs(tvb, loffset, len - 1 - not_counted, pinfo, att_tree);
+ decrement_dissection_depth(pinfo);
}
break;
case NM_ATT_INTERF_BOUND:
@@ -2804,8 +2807,7 @@ proto_register_abis_oml(void)
NM_ATT_TLVDEF_IPA(NM_ATT_IPACC_CGI, TLV_TYPE_TL16V, 0);
/* assign our custom match functions */
- proto_abis_oml = proto_register_protocol("GSM A-bis OML", "A-bis OML",
- "gsm_abis_oml");
+ proto_abis_oml = proto_register_protocol("GSM A-bis OML", "A-bis OML", "gsm_abis_oml");
proto_register_field_array(proto_abis_oml, hf, array_length(hf));
diff --git a/epan/dissectors/packet-gsm_gsup.c b/epan/dissectors/packet-gsm_gsup.c
index 6e36e00b..fe20fde6 100644
--- a/epan/dissectors/packet-gsm_gsup.c
+++ b/epan/dissectors/packet-gsm_gsup.c
@@ -696,6 +696,7 @@ static void dissect_name_ie(tvbuff_t *tvb, packet_info *pinfo _U_, guint offset,
static gint
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_gsup_tlvs(tvbuff_t *tvb, int base_offs, int length, packet_info *pinfo, proto_tree *tree,
proto_item *gsup_ti, guint8 msg_type)
{
@@ -729,6 +730,7 @@ dissect_gsup_tlvs(tvbuff_t *tvb, int base_offs, int length, packet_info *pinfo,
proto_tree_add_item(att_tree, hf_gsup_iei, tvb, offset-2, 1, ENC_BIG_ENDIAN);
proto_tree_add_uint(att_tree, hf_gsup_ie_len, tvb, offset-1, 1, len);
+ increment_dissection_depth(pinfo);
switch (tag) {
/* Nested TLVs */
case OSMO_GSUP_AUTH_TUPLE_IE:
@@ -884,6 +886,7 @@ dissect_gsup_tlvs(tvbuff_t *tvb, int base_offs, int length, packet_info *pinfo,
proto_tree_add_item(att_tree, hf_gsup_ie_payload, tvb, offset, len, ENC_NA);
break;
}
+ decrement_dissection_depth(pinfo);
offset += len;
}
diff --git a/epan/dissectors/packet-gtp.c b/epan/dissectors/packet-gtp.c
index 87861709..1302d80a 100644
--- a/epan/dissectors/packet-gtp.c
+++ b/epan/dissectors/packet-gtp.c
@@ -2408,12 +2408,15 @@ static const value_string gtp_ext_hdr_pdu_ses_cont_pdu_type_vals[] = {
#define MM_PROTO_SESSION_MGMT 0x0A
#define MM_PROTO_NON_CALL_RELATED 0x0B
-static wmem_map_t *gtpstat_msg_idx_hash = NULL;
+static GHashTable *gtpstat_msg_idx_hash = NULL;
static void
gtpstat_init(struct register_srt* srt _U_, GArray* srt_array)
{
- gtpstat_msg_idx_hash = wmem_map_new(wmem_file_scope(), g_direct_hash, g_direct_equal);
+ if (gtpstat_msg_idx_hash != NULL) {
+ g_hash_table_destroy(gtpstat_msg_idx_hash);
+ }
+ gtpstat_msg_idx_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
init_srt_table("GTP Requests", NULL, srt_array, 0, NULL, NULL, NULL);
}
@@ -2443,13 +2446,13 @@ gtpstat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const voi
gtp_srt_table = g_array_index(data->srt_array, srt_stat_table*, i);
- idx = GPOINTER_TO_UINT(wmem_map_lookup(gtpstat_msg_idx_hash, GUINT_TO_POINTER(gtp->msgtype)));
+ idx = GPOINTER_TO_UINT(g_hash_table_lookup(gtpstat_msg_idx_hash, GUINT_TO_POINTER(gtp->msgtype)));
/* Store the value incremented by 1 to avoid confusing index 0 with NULL */
if (idx == 0) {
- idx = wmem_map_size(gtpstat_msg_idx_hash);
- wmem_map_insert(gtpstat_msg_idx_hash, GUINT_TO_POINTER(gtp->msgtype), GUINT_TO_POINTER(idx + 1));
- init_srt_table_row(gtp_srt_table, idx, val_to_str_ext(gtp->msgtype, &gtp_message_type_ext, "Unknown (%d)"));
+ idx = g_hash_table_size(gtpstat_msg_idx_hash);
+ g_hash_table_insert(gtpstat_msg_idx_hash, GUINT_TO_POINTER(gtp->msgtype), GUINT_TO_POINTER(idx + 1));
+ init_srt_table_row(gtp_srt_table, idx, val_to_str_ext_const(gtp->msgtype, &gtp_message_type_ext, "Unknown"));
} else {
idx -= 1;
}
@@ -2987,7 +2990,7 @@ typedef struct {
/* ---------------------
* GPRS messages
* ---------------------*/
-static _gtp_mess_items gprs_mess_items[] = {
+static const _gtp_mess_items gprs_mess_items[] = {
{
GTP_MSG_ECHO_REQ, {
@@ -3319,7 +3322,7 @@ static _gtp_mess_items gprs_mess_items[] = {
/* -----------------------------
* UMTS messages
* -----------------------------*/
-static _gtp_mess_items umts_mess_items[] = {
+static const _gtp_mess_items umts_mess_items[] = {
/* 7.2 Path Management Messages */
{
GTP_MSG_ECHO_REQ, {
@@ -4391,7 +4394,7 @@ check_field_presence_and_decoder(guint8 message, guint8 field, int *position, ie
{
guint i = 0;
- _gtp_mess_items *mess_items;
+ const _gtp_mess_items *mess_items;
switch (gtp_version) {
case 0:
diff --git a/epan/dissectors/packet-gtpv2.c b/epan/dissectors/packet-gtpv2.c
index dc4a8204..4953729a 100644
--- a/epan/dissectors/packet-gtpv2.c
+++ b/epan/dissectors/packet-gtpv2.c
@@ -1561,12 +1561,15 @@ gtpv2_sn_equal_unmatched(gconstpointer k1, gconstpointer k2)
return key1->seq_nr == key2->seq_nr;
}
-static wmem_map_t *gtpv2_stat_msg_idx_hash = NULL;
+static GHashTable *gtpv2_stat_msg_idx_hash = NULL;
static void
gtpv2_stat_init(struct register_srt* srt _U_, GArray*srt_array)
{
- gtpv2_stat_msg_idx_hash = wmem_map_new(wmem_file_scope(), g_direct_hash, g_direct_equal);
+ if (gtpv2_stat_msg_idx_hash != NULL) {
+ g_hash_table_destroy(gtpv2_stat_msg_idx_hash);
+ }
+ gtpv2_stat_msg_idx_hash = g_hash_table_new(g_direct_hash, g_direct_equal);
init_srt_table("GTPv2 Requests", NULL, srt_array, 0, NULL, NULL, NULL);
}
@@ -1596,13 +1599,13 @@ gtpv2_stat_packet(void *pss, packet_info *pinfo, epan_dissect_t *edt _U_, const
* (requests and responses have different message types, and we
* only use the request value.)
*/
- idx = GPOINTER_TO_UINT(wmem_map_lookup(gtpv2_stat_msg_idx_hash, GUINT_TO_POINTER(gcrp->msgtype)));
+ idx = GPOINTER_TO_UINT(g_hash_table_lookup(gtpv2_stat_msg_idx_hash, GUINT_TO_POINTER(gcrp->msgtype)));
/* Store the row value incremented by 1 to distinguish 0 from NULL */
if (idx == 0) {
- idx = wmem_map_size(gtpv2_stat_msg_idx_hash);
- wmem_map_insert(gtpv2_stat_msg_idx_hash, GUINT_TO_POINTER(gcrp->msgtype), GUINT_TO_POINTER(idx + 1));
- init_srt_table_row(gtpv2_srt_table, idx, val_to_str_ext(gcrp->msgtype, &gtpv2_message_type_vals_ext, "Unknown (%d)"));
+ idx = g_hash_table_size(gtpv2_stat_msg_idx_hash);
+ g_hash_table_insert(gtpv2_stat_msg_idx_hash, GUINT_TO_POINTER(gcrp->msgtype), GUINT_TO_POINTER(idx + 1));
+ init_srt_table_row(gtpv2_srt_table, idx, val_to_str_ext_const(gcrp->msgtype, &gtpv2_message_type_vals_ext, "Unknown"));
} else {
idx -= 1;
}
@@ -8956,6 +8959,7 @@ dissect_gtpv2_ie_common(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_gtpv2(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data _U_)
{
proto_tree *gtpv2_tree;
@@ -9137,7 +9141,9 @@ dissect_gtpv2(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data
new_p_tvb = tvb_new_subset_remaining(tvb, msg_length + 4);
col_append_str(pinfo->cinfo, COL_INFO, " / ");
col_set_fence(pinfo->cinfo, COL_INFO);
+ increment_dissection_depth(pinfo);
dissect_gtpv2(new_p_tvb, pinfo, tree, NULL);
+ decrement_dissection_depth(pinfo);
}
return tvb_captured_length(tvb);
diff --git a/epan/dissectors/packet-h223.c b/epan/dissectors/packet-h223.c
index f6b451db..f0f99e7f 100644
--- a/epan/dissectors/packet-h223.c
+++ b/epan/dissectors/packet-h223.c
@@ -800,17 +800,20 @@ dissect_mux_sdu_fragment(tvbuff_t *volatile next_tvb, packet_info *pinfo,
}
static guint32
-mux_element_sublist_size( h223_mux_element* me )
+// NOLINTNEXTLINE(misc-no-recursion)
+mux_element_sublist_size(packet_info *pinfo, h223_mux_element* me)
{
h223_mux_element *current_me = me->next;
guint32 length = 0;
+ increment_dissection_depth(pinfo);
while ( current_me ) {
if ( current_me->sublist )
- length += current_me->repeat_count * mux_element_sublist_size( current_me->sublist );
+ length += current_me->repeat_count * mux_element_sublist_size(pinfo, current_me->sublist);
else
length += current_me->repeat_count;
current_me = current_me->next;
}
+ decrement_dissection_depth(pinfo);
/* should never happen, but to avoid infinite loops... */
DISSECTOR_ASSERT(length != 0);
@@ -832,6 +835,7 @@ mux_element_sublist_size( h223_mux_element* me )
* endOfMuxSdu true if the end-of-sdu flag was set
*/
static guint32
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_mux_payload_by_me_list( tvbuff_t *tvb, packet_info *pinfo,
guint32 pkt_offset, proto_tree *pdu_tree,
h223_call_info* call_info,
@@ -843,10 +847,11 @@ dissect_mux_payload_by_me_list( tvbuff_t *tvb, packet_info *pinfo,
guint32 frag_len;
guint32 sublist_len;
int i;
+ increment_dissection_depth(pinfo);
while ( me ) {
if ( me->sublist ) {
if ( me->repeat_count == 0 ) {
- for(sublist_len = mux_element_sublist_size( me->sublist );
+ for(sublist_len = mux_element_sublist_size(pinfo, me->sublist);
offset + sublist_len <= len;
offset = dissect_mux_payload_by_me_list( tvb, pinfo, pkt_offset, pdu_tree,
call_info, me->sublist, offset, endOfMuxSdu,
@@ -873,6 +878,7 @@ dissect_mux_payload_by_me_list( tvbuff_t *tvb, packet_info *pinfo,
}
me = me->next;
}
+ decrement_dissection_depth(pinfo);
return offset;
}
diff --git a/epan/dissectors/packet-h225.c b/epan/dissectors/packet-h225.c
index 5bd5f1f1..1d348ad1 100644
--- a/epan/dissectors/packet-h225.c
+++ b/epan/dissectors/packet-h225.c
@@ -1257,7 +1257,6 @@ static int dissect_h225_EnumeratedParameter(tvbuff_t *tvb _U_, int offset _U_, a
/*int dissect_h225_GenericData(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);*/
-#define MAX_RECURSION_DEPTH 100 // Arbitrarily chosen.
static int
@@ -3968,11 +3967,9 @@ static const per_sequence_t EnumeratedParameter_sequence[] = {
static int
dissect_h225_EnumeratedParameter(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 4;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // EnumeratedParameter → Content → Content/compound → EnumeratedParameter
+ actx->pinfo->dissection_depth += 3;
+ increment_dissection_depth(actx->pinfo);
gef_ctx_t *parent_gefx;
parent_gefx = gef_ctx_get(actx->private_data);
@@ -3980,7 +3977,8 @@ dissect_h225_EnumeratedParameter(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *
offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
ett_h225_EnumeratedParameter, EnumeratedParameter_sequence);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 3;
+ decrement_dissection_depth(actx->pinfo);
actx->private_data = parent_gefx;
return offset;
}
@@ -3994,11 +3992,9 @@ static const per_sequence_t GenericData_sequence[] = {
int
dissect_h225_GenericData(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 6;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // GenericData → GenericData/parameters → EnumeratedParameter → Content → Content/nested → GenericData
+ actx->pinfo->dissection_depth += 5;
+ increment_dissection_depth(actx->pinfo);
void *priv_data = actx->private_data;
gef_ctx_t *gefx;
@@ -4011,7 +4007,8 @@ dissect_h225_GenericData(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_
offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
ett_h225_GenericData, GenericData_sequence);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 5;
+ decrement_dissection_depth(actx->pinfo);
actx->private_data = priv_data;
return offset;
}
diff --git a/epan/dissectors/packet-h245.c b/epan/dissectors/packet-h245.c
index 5fb832f5..92b9fa55 100644
--- a/epan/dissectors/packet-h245.c
+++ b/epan/dissectors/packet-h245.c
@@ -2426,7 +2426,6 @@ static int dissect_h245_AudioMode(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t
static int dissect_h245_ModeElementType(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
-#define MAX_RECURSION_DEPTH 100 // Arbitrarily chosen.
static int
@@ -3865,15 +3864,14 @@ static const per_sequence_t GenericParameter_sequence[] = {
static int
dissect_h245_GenericParameter(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 4;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // GenericParameter → ParameterValue → ParameterValue/genericParameter → GenericParameter
+ actx->pinfo->dissection_depth += 3;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
ett_h245_GenericParameter, GenericParameter_sequence);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 3;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
@@ -5666,11 +5664,9 @@ static const per_choice_t VideoCapability_choice[] = {
static int
dissect_h245_VideoCapability(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 4;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // VideoCapability → ExtendedVideoCapability → ExtendedVideoCapability/videoCapability → VideoCapability
+ actx->pinfo->dissection_depth += 3;
+ increment_dissection_depth(actx->pinfo);
gint32 value;
offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
@@ -5680,7 +5676,8 @@ dissect_h245_VideoCapability(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx
codec_type = val_to_str(value, h245_VideoCapability_vals, "<unknown>");
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 3;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
@@ -5988,11 +5985,9 @@ static const per_choice_t AudioCapability_choice[] = {
static int
dissect_h245_AudioCapability(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 3;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // AudioCapability → VBDCapability → AudioCapability
+ actx->pinfo->dissection_depth += 2;
+ increment_dissection_depth(actx->pinfo);
gint32 value;
offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
@@ -6001,7 +5996,8 @@ dissect_h245_AudioCapability(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx
codec_type = val_to_str(value, h245_AudioCapability_short_vals, "<unknown>");
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 2;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
@@ -7152,11 +7148,9 @@ static const per_choice_t DataType_choice[] = {
static int
dissect_h245_DataType(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 5;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // DataType → H235Media → H235Media/mediaType → RedundancyEncoding → DataType
+ actx->pinfo->dissection_depth += 4;
+ increment_dissection_depth(actx->pinfo);
gint choice_index;
offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
@@ -7173,7 +7167,8 @@ if (upcoming_channel){
}
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 4;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
@@ -8874,11 +8869,9 @@ static const per_sequence_t MultiplexElement_sequence[] = {
static int
dissect_h245_MultiplexElement(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 4;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // MultiplexElement → MultiplexElement/type → MultiplexElement/type/subElementList → MultiplexElement
+ actx->pinfo->dissection_depth += 3;
+ increment_dissection_depth(actx->pinfo);
/*MultiplexElement*/
h223_mux_element* me = wmem_new(wmem_file_scope(), h223_mux_element);
h223_me->next = me;
@@ -8887,7 +8880,8 @@ dissect_h245_MultiplexElement(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *act
offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
ett_h245_MultiplexElement, MultiplexElement_sequence);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 3;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
@@ -9509,11 +9503,9 @@ static const per_choice_t AudioMode_choice[] = {
static int
dissect_h245_AudioMode(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 3;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // AudioMode → VBDMode → AudioMode
+ actx->pinfo->dissection_depth += 2;
+ increment_dissection_depth(actx->pinfo);
gint32 value;
offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
@@ -9522,7 +9514,8 @@ dissect_h245_AudioMode(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_,
codec_type = val_to_str(value, h245_AudioMode_vals, "<unknown>");
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 2;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
@@ -9868,16 +9861,15 @@ static const per_choice_t ModeElementType_choice[] = {
static int
dissect_h245_ModeElementType(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 6;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // ModeElementType → RedundancyEncodingDTMode → RedundancyEncodingDTModeElement → RedundancyEncodingDTModeElement/type → FECMode → ModeElementType
+ actx->pinfo->dissection_depth += 5;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_per_choice(tvb, offset, actx, tree, hf_index,
ett_h245_ModeElementType, ModeElementType_choice,
NULL);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 5;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
diff --git a/epan/dissectors/packet-h248.c b/epan/dissectors/packet-h248.c
index ca5f4192..d1799fed 100644
--- a/epan/dissectors/packet-h248.c
+++ b/epan/dissectors/packet-h248.c
@@ -2619,7 +2619,6 @@ static int dissect_h248_MtpAddress(bool implicit_tag, tvbuff_t *tvb, int offset,
static int dissect_h248_SecondEventsDescriptor(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
-#define MAX_RECURSION_DEPTH 100 // Arbitrarily chosen.
static int
@@ -4248,15 +4247,14 @@ static const ber_sequence_t SecondEventsDescriptor_sequence[] = {
static int
dissect_h248_SecondEventsDescriptor(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 7;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // SecondEventsDescriptor → SecondEventsDescriptor/eventList → SecondRequestedEvent → SecondRequestedActions → NotifyBehaviour → RegulatedEmbeddedDescriptor → SecondEventsDescriptor
+ actx->pinfo->dissection_depth += 6;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
SecondEventsDescriptor_sequence, hf_index, ett_h248_SecondEventsDescriptor);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 6;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
diff --git a/epan/dissectors/packet-h264.c b/epan/dissectors/packet-h264.c
index 9d9a1256..8ca3f5e9 100644
--- a/epan/dissectors/packet-h264.c
+++ b/epan/dissectors/packet-h264.c
@@ -561,17 +561,20 @@ dissect_h264_exp_golomb_code(proto_tree *tree, int hf_index, tvbuff_t *tvb, gint
start_offset = *start_bit_offset>>3;
- if (hf_index > -1)
+ if (hf_index > -1) {
hf_field = proto_registrar_get_nth(hf_index);
+ }
- switch (descriptor) {
- case H264_SE_V:
- DISSECTOR_ASSERT_FIELD_TYPE(hf_field, FT_INT32);
- break;
+ if (hf_field) {
+ switch (descriptor) {
+ case H264_SE_V:
+ DISSECTOR_ASSERT_FIELD_TYPE(hf_field, FT_INT32);
+ break;
- default:
- DISSECTOR_ASSERT_FIELD_TYPE(hf_field, FT_UINT32);
- break;
+ default:
+ DISSECTOR_ASSERT_FIELD_TYPE(hf_field, FT_UINT32);
+ break;
+ }
}
bit_offset = *start_bit_offset;
@@ -2131,6 +2134,7 @@ static int dissect_h264_prefix(proto_tree *tree, tvbuff_t *tvb, packet_info *pin
/* RFC 6190 Section: 4.9 - Payload Content Scalability Information (PACSI) */
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_h264_pacsi(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset)
{
gint8 pacsi_flags;
@@ -2201,6 +2205,7 @@ dissect_h264_pacsi(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint off
* RFC 3984 Section 5.7.1 - Single-Time Aggregation Packet (STAP)
*/
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_h264_stap(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset, gint8 nal_type)
{
guint16 nal_unit_size;
@@ -2246,6 +2251,7 @@ dissect_h264_stap(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint
* RFC 3984 Section 5.7.2 Multi-Time Aggregation Packet (MTAP)
*/
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_h264_mtap(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset, gint8 nal_type)
{
gint size_offset;
@@ -2303,6 +2309,7 @@ dissect_h264_mtap(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint
* Dissect NAL Header extension and NI-MTAP Subtype defined in RFC 6190
*/
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_h264_nalu_extension (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
{
gint size_offset;
@@ -2545,6 +2552,7 @@ dissect_h264_bytestream(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
/* Code to actually dissect the packets */
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_h264(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
int offset = 0;
@@ -2615,6 +2623,7 @@ dissect_h264(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
rbsp_tvb = dissect_h265_unescap_nal_unit(tvb, pinfo, offset);
stream_tree = proto_tree_add_subtree(h264_tree, tvb, offset, -1, ett_h264_stream, NULL, "H264 NAL Unit Payload");
+ increment_dissection_depth(pinfo);
switch (type) {
case 1: /* 1 Coded slice of a non-IDR picture */
dissect_h264_slice_layer_without_partitioning_rbsp(stream_tree, rbsp_tvb, pinfo, 0);
@@ -2660,6 +2669,7 @@ dissect_h264(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
default:
break;
}
+ decrement_dissection_depth(pinfo);
} /* if (tree) */
return tvb_captured_length(tvb);
}
diff --git a/epan/dissectors/packet-h265.c b/epan/dissectors/packet-h265.c
index eb71ca59..cd0a0481 100644
--- a/epan/dissectors/packet-h265.c
+++ b/epan/dissectors/packet-h265.c
@@ -801,18 +801,21 @@ dissect_h265_exp_golomb_code(proto_tree *tree, int hf_index, tvbuff_t *tvb, pack
start_offset = *start_bit_offset >> 3;
- if (hf_index > -1)
+ if (hf_index > -1) {
hf_field = proto_registrar_get_nth(hf_index);
+ }
- /* Allow only gint32 for se(v), guint32 for others. */
- switch (descriptor) {
- case H265_SE_V:
- DISSECTOR_ASSERT_FIELD_TYPE(hf_field, FT_INT32);
- break;
+ if (hf_field) {
+ /* Allow only gint32 for se(v), guint32 for others. */
+ switch (descriptor) {
+ case H265_SE_V:
+ DISSECTOR_ASSERT_FIELD_TYPE(hf_field, FT_INT32);
+ break;
- default:
- DISSECTOR_ASSERT_FIELD_TYPE(hf_field, FT_UINT32);
- break;
+ default:
+ DISSECTOR_ASSERT_FIELD_TYPE(hf_field, FT_UINT32);
+ break;
+ }
}
bit_offset = *start_bit_offset;
diff --git a/epan/dissectors/packet-hsms.c b/epan/dissectors/packet-hsms.c
index 361012aa..b30c3934 100644
--- a/epan/dissectors/packet-hsms.c
+++ b/epan/dissectors/packet-hsms.c
@@ -174,6 +174,7 @@ static gint ett_hsms_data_item = -1;
#define HSMS_MIN_LENGTH 14
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_secs_variable(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data, int *offset)
{
proto_item *hdr_stream_item;
@@ -265,7 +266,9 @@ dissect_secs_variable(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
if (item_format_code == 0)
{
/* add sub items for list element to item tree */
+ increment_dissection_depth(pinfo);
int subItemLength = dissect_secs_variable(tvb, pinfo, hsms_data_item_tree, data, offset);
+ decrement_dissection_depth(pinfo);
/* check for parsing error in sub list */
if (subItemLength == -1)
@@ -733,11 +736,7 @@ proto_register_hsms(void)
};
/* Register the protocol name and description */
- proto_hsms = proto_register_protocol (
- "High-speed SECS Message Service Protocol", /* name */
- "HSMS", /* short name */
- "hsms" /* abbrev */
- );
+ proto_hsms = proto_register_protocol ("High-speed SECS Message Service Protocol", "HSMS", "hsms");
/* Required function calls to register the header fields and subtrees */
proto_register_field_array(proto_hsms, hf, array_length(hf));
diff --git a/epan/dissectors/packet-http2.c b/epan/dissectors/packet-http2.c
index 7d9cac01..5def945a 100644
--- a/epan/dissectors/packet-http2.c
+++ b/epan/dissectors/packet-http2.c
@@ -2947,6 +2947,78 @@ get_reassembly_id_from_stream(packet_info *pinfo, http2_session_t* session)
return stream_info->stream_id | (flow_index << 31);
}
+/*
+ * Like process_reassembled_data() in reassemble.[ch], but ignores the layer
+ * number, which is not always stable in HTTP/2, if multiple TLS records are
+ * in the same frame.
+ */
+static tvbuff_t*
+http2_process_reassembled_data(tvbuff_t *tvb, const int offset, packet_info *pinfo,
+ const char *name, fragment_head *fd_head, const fragment_items *fit,
+ gboolean *update_col_infop, proto_tree *tree)
+{
+ tvbuff_t* next_tvb;
+ gboolean update_col_info;
+ proto_item* frag_tree_item;
+
+ if (fd_head != NULL) {
+ /*
+ * OK, we've reassembled this.
+ * Is this something that's been reassembled from more
+ * than one fragment?
+ */
+ if (fd_head->next != NULL) {
+ /*
+ * Yes.
+ * Allocate a new tvbuff, referring to the
+ * reassembled payload, and set
+ * the tvbuff to the list of tvbuffs to which
+ * the tvbuff we were handed refers, so it'll get
+ * cleaned up when that tvbuff is cleaned up.
+ */
+ next_tvb = tvb_new_chain(tvb, fd_head->tvb_data);
+
+ /* Add the defragmented data to the data source list. */
+ add_new_data_source(pinfo, next_tvb, name);
+
+ /* show all fragments */
+ if (fd_head->flags & FD_BLOCKSEQUENCE) {
+ update_col_info = !show_fragment_seq_tree(
+ fd_head, fit, tree, pinfo, next_tvb, &frag_tree_item);
+ }
+ else {
+ update_col_info = !show_fragment_tree(fd_head,
+ fit, tree, pinfo, next_tvb, &frag_tree_item);
+ }
+ }
+ else {
+ /*
+ * No.
+ * Return a tvbuff with the payload. next_tvb ist from offset until end
+ */
+ next_tvb = tvb_new_subset_remaining(tvb, offset);
+ pinfo->fragmented = FALSE; /* one-fragment packet */
+ update_col_info = TRUE;
+ }
+ if (update_col_infop != NULL)
+ *update_col_infop = update_col_info;
+ } else {
+ /*
+ * We don't have the complete reassembled payload, or this
+ * isn't the final frame of that payload.
+ */
+ next_tvb = NULL;
+ /* process_reassembled_data() in reassemble.[ch] adds reassembled_in
+ * here, but the reas_in_layer_num is often unstable in HTTP/2 now so
+ * we rely on the stream end flag (that's why we have this function).
+ *
+ * Perhaps we could DISSECTOR_ASSERT() in this path, we shouldn't
+ * get here.
+ */
+ }
+ return next_tvb;
+}
+
static tvbuff_t*
reassemble_http2_data_into_full_frame(tvbuff_t *tvb, packet_info *pinfo, http2_session_t* http2_session, proto_tree *http2_tree, guint offset,
guint8 flags, guint datalen)
@@ -2973,8 +3045,8 @@ reassemble_http2_data_into_full_frame(tvbuff_t *tvb, packet_info *pinfo, http2_s
* incorrectly match for frames that exist in the same packet as the final DATA frame and incorrectly add
* reassembly information to those dissection trees */
if (head && IS_HTTP2_END_STREAM(flags)) {
- return process_reassembled_data(tvb, offset, pinfo, "Reassembled body", head,
- &http2_body_fragment_items, NULL, http2_tree);
+ return http2_process_reassembled_data(tvb, offset, pinfo, "Reassembled body", head,
+ &http2_body_fragment_items, NULL, http2_tree);
}
/* Add frame where reassembly happened. process_reassembled_data() does this automatically if the reassembled
diff --git a/epan/dissectors/packet-icmpv6.c b/epan/dissectors/packet-icmpv6.c
index 1b0d5a22..08b29344 100644
--- a/epan/dissectors/packet-icmpv6.c
+++ b/epan/dissectors/packet-icmpv6.c
@@ -1682,8 +1682,9 @@ static icmp_transaction_t *transaction_end(packet_info *pinfo, proto_tree *tree,
} /* transaction_end() */
-static int
-dissect_icmpv6_nd_opt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
+// This is recursive, but we'll run out of PDU before we'll run out of stack.
+// NOLINTNEXTLINE(misc-no-recursion)
+static int dissect_icmpv6_nd_opt(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
proto_tree *icmp6opt_tree;
proto_item *ti, *ti_opt, *ti_opt_len;
diff --git a/epan/dissectors/packet-icq.c b/epan/dissectors/packet-icq.c
index 93e55bd1..2df62eee 100644
--- a/epan/dissectors/packet-icq.c
+++ b/epan/dissectors/packet-icq.c
@@ -786,6 +786,7 @@ icqv5_srv_user_online(proto_tree *tree,/* Tree to put the data in */
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
icqv5_srv_multi(proto_tree *tree, /* Tree to put the data in */
tvbuff_t *tvb, /* Packet content */
int offset, /* Offset from the start of the packet to the content */
@@ -804,6 +805,7 @@ icqv5_srv_multi(proto_tree *tree, /* Tree to put the data in */
for (i = 0; i < num; i++) {
pktSz = tvb_get_letohs(tvb, offset);
offset += 2;
+ // We recurse here, but we'll run out of packet before we run out of stack.
dissect_icqv5Server(tvb, offset, pinfo, tree, pktSz);
offset += pktSz;
}
@@ -1123,6 +1125,7 @@ dissect_icqv5Client(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_icqv5Server(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, int pktsize)
{
@@ -1180,6 +1183,7 @@ dissect_icqv5Server(tvbuff_t *tvb, int offset, packet_info *pinfo,
pktsize - ICQ5_SRV_HDRSIZE, pinfo);
break;
case SRV_MULTI:
+ // We recurse here, but we'll run out of packet before we run out of stack.
icqv5_srv_multi(icq_body_tree, tvb, offset + ICQ5_SRV_HDRSIZE, pinfo);
break;
case SRV_ACK:
diff --git a/epan/dissectors/packet-ieee1609dot2.c b/epan/dissectors/packet-ieee1609dot2.c
index 9675333e..2c06c97e 100644
--- a/epan/dissectors/packet-ieee1609dot2.c
+++ b/epan/dissectors/packet-ieee1609dot2.c
@@ -427,7 +427,6 @@ ieee1609dot2_set_next_default_psid(packet_info *pinfo, guint32 psid)
static int dissect_ieee1609dot2_Ieee1609Dot2Data(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
-#define MAX_RECURSION_DEPTH 100 // Arbitrarily chosen.
static int
@@ -3024,16 +3023,15 @@ static const oer_sequence_t Ieee1609Dot2Data_sequence[] = {
static int
dissect_ieee1609dot2_Ieee1609Dot2Data(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 6;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // Ieee1609Dot2Data → Ieee1609Dot2Content → SignedData → ToBeSignedData → SignedDataPayload → Ieee1609Dot2Data
+ actx->pinfo->dissection_depth += 5;
+ increment_dissection_depth(actx->pinfo);
actx->private_data = (void*)wmem_new0(actx->pinfo->pool, ieee1609_private_data_t);
offset = dissect_oer_sequence(tvb, offset, actx, tree, hf_index,
ett_ieee1609dot2_Ieee1609Dot2Data, Ieee1609Dot2Data_sequence);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 5;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
diff --git a/epan/dissectors/packet-ieee1722.c b/epan/dissectors/packet-ieee1722.c
index e7a9b5f1..277de8f7 100644
--- a/epan/dissectors/packet-ieee1722.c
+++ b/epan/dissectors/packet-ieee1722.c
@@ -2652,7 +2652,7 @@ static int dissect_1722_acf_can_common(tvbuff_t *tvb, packet_info *pinfo, proto_
}
can_info.len = (guint32)parsed.datalen;
- can_info.fd = parsed.is_fd;
+ can_info.fd = parsed.is_fd ? CAN_TYPE_CAN_FD : CAN_TYPE_CAN_CLASSIC;
/* for practical reasons a remapping might be needed in the future */
can_info.bus_id = (guint16)parsed.bus_id;
diff --git a/epan/dissectors/packet-ip.c b/epan/dissectors/packet-ip.c
index 355fc6c0..481d3725 100644
--- a/epan/dissectors/packet-ip.c
+++ b/epan/dissectors/packet-ip.c
@@ -568,7 +568,7 @@ capture_ip(const guchar *pd, int offset, int len, capture_packet_info_t *cpinfo,
}
static void
-add_geoip_info_entry(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, ws_in4_addr ip, int isdst)
+add_geoip_info_entry(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, ws_in4_addr ip, gboolean isdst)
{
const mmdb_lookup_t *lookup = maxmind_db_lookup_ipv4(&ip);
if (!lookup->found) return;
@@ -593,7 +593,7 @@ add_geoip_info_entry(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint o
wmem_strbuf_append(summary, lookup->as_org);
}
- int addr_offset = offset + isdst ? IPH_DST : IPH_SRC;
+ int addr_offset = offset + (isdst ? IPH_DST : IPH_SRC);
int dir_hf = isdst ? hf_geoip_dst_summary : hf_geoip_src_summary;
proto_item *geoip_info_item = proto_tree_add_string(tree, dir_hf, tvb, addr_offset, 4, wmem_strbuf_finalize(summary));
proto_item_set_generated(geoip_info_item);
diff --git a/epan/dissectors/packet-ipp.c b/epan/dissectors/packet-ipp.c
index 8c6941d5..03855671 100644
--- a/epan/dissectors/packet-ipp.c
+++ b/epan/dissectors/packet-ipp.c
@@ -377,20 +377,20 @@ static const value_string status_vals[] = {
{ 0, NULL }
};
-static int parse_attributes(tvbuff_t *tvb, int offset, proto_tree *tree);
+static int parse_attributes(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree);
static proto_tree *add_integer_tree(proto_tree *tree, tvbuff_t *tvb,
int offset, int name_length, const gchar *name, int value_length, guint8 tag);
static void add_integer_value(const gchar *tag_desc, proto_tree *tree,
tvbuff_t *tvb, int offset, int name_length, const gchar *name, int value_length, guint8 tag);
-static proto_tree *add_octetstring_tree(proto_tree *tree, tvbuff_t *tvb,
+static proto_tree *add_octetstring_tree(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo,
int offset, int name_length, const gchar *name, int value_length, guint8 tag);
static proto_tree *add_octetstring_value(const gchar *tag_desc, proto_tree *tree,
- tvbuff_t *tvb, int offset, int name_length, const gchar *name, int value_length, guint8 tag);
+ tvbuff_t *tvb, packet_info *pinfo, int offset, int name_length, const gchar *name, int value_length, guint8 tag);
static proto_tree *add_charstring_tree(proto_tree *tree, tvbuff_t *tvb,
int offset, guint8 tag, int name_length, const gchar *name, int value_length);
static void add_charstring_value(const gchar *tag_desc, proto_tree *tree,
tvbuff_t *tvb, int offset, int name_length, const gchar *name, int value_length, guint8 tag);
-static int ipp_fmt_collection(tvbuff_t *tvb, int offset, char *buffer, int bufsize);
+static int ipp_fmt_collection(tvbuff_t *tvb, packet_info *pinfo, int offset, char *buffer, int bufsize);
static int
dissect_ipp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
@@ -546,7 +546,7 @@ dissect_ipp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
proto_tree_add_item(ipp_tree, hf_ipp_request_id, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
- offset = parse_attributes(tvb, offset, ipp_tree);
+ offset = parse_attributes(tvb, pinfo, offset, ipp_tree);
if (tvb_offset_exists(tvb, offset)) {
call_data_dissector(tvb_new_subset_remaining(tvb, offset), pinfo, ipp_tree);
@@ -630,7 +630,7 @@ static const value_string tag_vals[] = {
};
static int
-parse_attributes(tvbuff_t *tvb, int offset, proto_tree *tree)
+parse_attributes(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree)
{
guint8 tag;
const gchar *tag_desc;
@@ -746,12 +746,12 @@ parse_attributes(tvbuff_t *tvb, int offset, proto_tree *tree)
* an additional value, so
* start a tree for it.
*/
- attr_tree = add_octetstring_tree(as_tree, tvb, offset, name_length, name, value_length, tag);
+ attr_tree = add_octetstring_tree(as_tree, tvb, pinfo, offset, name_length, name, value_length, tag);
}
if (tag == TAG_ENDCOLLECTION)
attr_tree = proto_tree_get_parent_tree(attr_tree);
else
- attr_tree = add_octetstring_value(tag_desc, attr_tree, tvb, offset, name_length, name, value_length, tag);
+ attr_tree = add_octetstring_value(tag_desc, attr_tree, tvb, pinfo, offset, name_length, name, value_length, tag);
break;
case TAG_TYPE_CHARSTRING :
@@ -1007,7 +1007,7 @@ add_integer_value(const gchar *tag_desc, proto_tree *tree, tvbuff_t *tvb,
}
static proto_tree *
-add_octetstring_tree(proto_tree *tree, tvbuff_t *tvb, int offset, int name_length, const gchar *name, int value_length, guint8 tag)
+add_octetstring_tree(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset, int name_length, const gchar *name, int value_length, guint8 tag)
{
int count = 0;
const char *type = val_to_str(tag, tag_vals, "unknown-%02x");
@@ -1232,7 +1232,7 @@ add_octetstring_tree(proto_tree *tree, tvbuff_t *tvb, int offset, int name_lengt
count ++;
- valoffset = ipp_fmt_collection(tvb, valoffset + 1 + 2 + name_length + 2 + value_length, temp, sizeof(temp));
+ valoffset = ipp_fmt_collection(tvb, pinfo, valoffset + 1 + 2 + name_length + 2 + value_length, temp, sizeof(temp));
if (value)
value = wmem_strconcat(wmem_packet_scope(), value, ",", temp, NULL);
@@ -1268,7 +1268,7 @@ add_octetstring_tree(proto_tree *tree, tvbuff_t *tvb, int offset, int name_lengt
}
static proto_tree *
-add_octetstring_value(const gchar *tag_desc, proto_tree *tree, tvbuff_t *tvb,
+add_octetstring_value(const gchar *tag_desc, proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo,
int offset, int name_length, const gchar *name _U_, int value_length, guint8 tag)
{
proto_tree *subtree = tree;
@@ -1357,7 +1357,7 @@ add_octetstring_value(const gchar *tag_desc, proto_tree *tree, tvbuff_t *tvb,
break;
case TAG_BEGCOLLECTION :
- endoffset = ipp_fmt_collection(tvb, valoffset + value_length, value, sizeof(value));
+ endoffset = ipp_fmt_collection(tvb, pinfo, valoffset + value_length, value, sizeof(value));
subtree = proto_tree_add_subtree_format(tree, tvb, valoffset, endoffset - valoffset, ett_ipp_member, NULL, "collection %s", value);
break;
@@ -1450,7 +1450,8 @@ add_charstring_value(const gchar *tag_desc, proto_tree *tree, tvbuff_t *tvb,
}
static int
-ipp_fmt_collection(tvbuff_t *tvb, int valoffset, char *buffer, int bufsize)
+// NOLINTNEXTLINE(misc-no-recursion)
+ipp_fmt_collection(tvbuff_t *tvb, packet_info *pinfo, int valoffset, char *buffer, int bufsize)
{
char *bufptr = buffer, *bufend = buffer + bufsize - 1;
guint8 tag;
@@ -1499,7 +1500,9 @@ ipp_fmt_collection(tvbuff_t *tvb, int valoffset, char *buffer, int bufsize)
if (tag == TAG_BEGCOLLECTION) {
char temp[176];
- valoffset = ipp_fmt_collection(tvb, valoffset, temp, sizeof(temp));
+ increment_dissection_depth(pinfo);
+ valoffset = ipp_fmt_collection(tvb, pinfo, valoffset, temp, sizeof(temp));
+ decrement_dissection_depth(pinfo);
if (!overflow) {
if ((bufend - bufptr) < (int)strlen(temp)) {
(void) g_strlcpy(bufptr, "...", bufend - bufptr + 1);
diff --git a/epan/dissectors/packet-ippusb.c b/epan/dissectors/packet-ippusb.c
index e2f9e963..a2a2571b 100644
--- a/epan/dissectors/packet-ippusb.c
+++ b/epan/dissectors/packet-ippusb.c
@@ -203,7 +203,6 @@ dissect_ippusb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
gint next_offset;
guint8 last;
guint8 status_code;
- const guchar *last_chunk = NULL;
struct ippusb_analysis *ippusbd = NULL;
conversation_t *conv = NULL;
@@ -234,9 +233,10 @@ dissect_ippusb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
last = tvb_get_guint8(tvb, captured_length - 1);
status_code = tvb_get_bits8(tvb, 3 * BITS_PER_BYTE, BITS_PER_BYTE);
- /* If segment has length of last chunk from chunk transfer */
- if(captured_length == CHUNK_LENGTH_MIN){
- last_chunk = tvb_get_ptr(tvb, offset, captured_length);
+ /* Is the segment the last chunk from chunk transfer? */
+ bool is_last_chunk = false;
+ if (captured_length == CHUNK_LENGTH_MIN) {
+ is_last_chunk = tvb_memeql(tvb, offset, CHUNKED_END, CHUNK_LENGTH_MIN) == 0;
}
if (is_http_header(first_linelen, first_line) && last == TAG_END_OF_ATTRIBUTES && status_code != PRINT_JOB && status_code != SEND_DOCUMENT) {
@@ -292,7 +292,7 @@ dissect_ippusb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
new_msp->document |= MSP_HAS_DOCUMENT;
}
- if(!(last_chunk && strncmp(last_chunk, CHUNKED_END, CHUNK_LENGTH_MIN) == 0)){
+ if (!is_last_chunk) {
/* If this segment is not the last chunk in a chunked transfer */
if (captured_length < reported_length && (new_msp->document & MSP_HAS_DOCUMENT)) {
@@ -403,7 +403,7 @@ dissect_ippusb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
}
}
}
- else if (current_msp &&last_chunk && strncmp(last_chunk, CHUNKED_END, CHUNK_LENGTH_MIN) == 0) {
+ else if (current_msp && is_last_chunk) {
/* This is the last segment of the chunked transfer and reassembled packet */
proto_tree_add_item(tree, proto_ippusb, tvb, offset, -1, ENC_NA);
diff --git a/epan/dissectors/packet-ipv6.c b/epan/dissectors/packet-ipv6.c
index 3358b92b..2e62cf29 100644
--- a/epan/dissectors/packet-ipv6.c
+++ b/epan/dissectors/packet-ipv6.c
@@ -1027,7 +1027,7 @@ capture_ipv6_exthdr(const guchar *pd, int offset, int len, capture_packet_info_t
}
static void
-add_geoip_info_entry(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, const ws_in6_addr *ip6, int isdst)
+add_geoip_info_entry(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint offset, const ws_in6_addr *ip6, gboolean isdst)
{
const mmdb_lookup_t *lookup = maxmind_db_lookup_ipv6(ip6);
if (!lookup->found) return;
@@ -1052,7 +1052,7 @@ add_geoip_info_entry(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, gint o
wmem_strbuf_append(summary, lookup->as_org);
}
- int addr_offset = offset + isdst ? IP6H_DST : IP6H_SRC;
+ int addr_offset = offset + (isdst ? IP6H_DST : IP6H_SRC);
int dir_hf = isdst ? hf_geoip_dst_summary : hf_geoip_src_summary;
proto_item *geoip_info_item = proto_tree_add_string(tree, dir_hf, tvb, addr_offset, 16, wmem_strbuf_finalize(summary));
proto_item_set_generated(geoip_info_item);
diff --git a/epan/dissectors/packet-isakmp.c b/epan/dissectors/packet-isakmp.c
index 35d05677..03020be7 100644
--- a/epan/dissectors/packet-isakmp.c
+++ b/epan/dissectors/packet-isakmp.c
@@ -3128,6 +3128,7 @@ static const bytes_string vendor_id[] = {
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_payloads(tvbuff_t *tvb, proto_tree *tree,
int isakmp_version, guint8 initial_payload, int offset, int length,
packet_info *pinfo, guint32 message_id, gboolean is_request, void* decr_data)
@@ -3148,6 +3149,7 @@ dissect_payloads(tvbuff_t *tvb, proto_tree *tree,
ntree = dissect_payload_header(tvb, pinfo, offset, length, isakmp_version, payload, &next_payload, &payload_length, tree);
if (payload_length >= 4) { /* XXX = > 4? */
+ increment_dissection_depth(pinfo);
tvb_ensure_bytes_exist(tvb, offset + 4, payload_length - 4);
switch(payload){
case PLOAD_IKE_SA:
@@ -3250,6 +3252,7 @@ dissect_payloads(tvbuff_t *tvb, proto_tree *tree,
proto_tree_add_item(ntree, hf_isakmp_datapayload, tvb, offset + 4, payload_length-4, ENC_NA);
break;
}
+ increment_dissection_depth(pinfo);
}
else if (payload_length > length) {
proto_tree_add_expert_format(ntree, pinfo, &ei_isakmp_payload_bad_length, tvb, 0, 0,
@@ -3279,6 +3282,7 @@ isakmp_dissect_payloads(tvbuff_t *tvb, proto_tree *tree, int isakmp_version,
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_isakmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
int offset = 0, len;
@@ -3530,6 +3534,7 @@ dissect_payload_header(tvbuff_t *tvb, packet_info *pinfo, int offset, int length
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_sa(tvbuff_t *tvb, int offset, int length, proto_tree *tree, int isakmp_version, packet_info *pinfo, gboolean is_request, void* decr_data)
{
guint32 doi;
@@ -4549,6 +4554,7 @@ dissect_nonce(tvbuff_t *tvb, int offset, int length, proto_tree *ntree)
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_cisco_fragmentation(tvbuff_t *tvb, int offset, int length, proto_tree *tree, packet_info *pinfo)
{
guint8 seq; /* Packet sequence number, starting from 1 */
@@ -4603,6 +4609,7 @@ dissect_cisco_fragmentation(tvbuff_t *tvb, int offset, int length, proto_tree *t
/* This is RFC7383 reassembly. */
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_ikev2_fragmentation(tvbuff_t *tvb, int offset, proto_tree *tree,
packet_info *pinfo, guint message_id, guint8 next_payload, gboolean is_request, void* decr_info)
{
@@ -5537,6 +5544,7 @@ dissect_sa_kek(tvbuff_t *tvb, packet_info *pinfo _U_, int offset, int length, pr
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_sa_tek(tvbuff_t *tvb, packet_info *pinfo _U_, int offset, int length, proto_tree *tree)
{
int offset_end = 0, payload_end=0;
@@ -5603,7 +5611,9 @@ dissect_sa_tek(tvbuff_t *tvb, packet_info *pinfo _U_, int offset, int length, pr
}
if(PLOAD_IKE_SAT == next_payload)
{
+ increment_dissection_depth(pinfo);
dissect_sa_tek(tvb, pinfo, offset, length, tree);
+ decrement_dissection_depth(pinfo);
}
} else {
proto_tree_add_item(ntree, hf_isakmp_sat_payload, tvb, offset, offset_end - offset, ENC_NA);
@@ -5856,6 +5866,7 @@ dissect_ts_payload(tvbuff_t *tvb, int offset, int length, proto_tree *tree)
/* For RFC 7383 reassembly, only need decrypted payload, so don't set dissect_payload_now .*/
/* TODO: rename? */
static tvbuff_t*
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_enc(tvbuff_t *tvb,
int offset,
int length,
diff --git a/epan/dissectors/packet-iscsi.c b/epan/dissectors/packet-iscsi.c
index 0741025c..69072b9d 100644
--- a/epan/dissectors/packet-iscsi.c
+++ b/epan/dissectors/packet-iscsi.c
@@ -715,6 +715,7 @@ handleDataSegmentAsTextKeys(iscsi_session_t *iscsi_session, packet_info *pinfo,
/* Code to actually dissect the packets */
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, guint8 opcode, guint32 data_segment_len, iscsi_session_t *iscsi_session, conversation_t *conversation) {
guint original_offset = offset;
@@ -1562,7 +1563,9 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off
tt = proto_tree_add_subtree(ti, tvb, offset, -1, ett_iscsi_RejectHeader, NULL, "Rejected Header");
+ increment_dissection_depth(pinfo);
dissect_iscsi_pdu(tvb, pinfo, tt, offset, next_opcode, 0, iscsi_session, conversation);
+ decrement_dissection_depth(pinfo);
} else if(opcode == ISCSI_OPCODE_VENDOR_SPECIFIC_I0 ||
opcode == ISCSI_OPCODE_VENDOR_SPECIFIC_I1 ||
opcode == ISCSI_OPCODE_VENDOR_SPECIFIC_I2 ||
diff --git a/epan/dissectors/packet-isis-lsp.c b/epan/dissectors/packet-isis-lsp.c
index 598052ca..db15cfb7 100644
--- a/epan/dissectors/packet-isis-lsp.c
+++ b/epan/dissectors/packet-isis-lsp.c
@@ -21,8 +21,9 @@
#include "config.h"
-#include <epan/packet.h>
#include <epan/expert.h>
+#include <epan/packet.h>
+
#include "packet-osi.h"
#include "packet-isis.h"
#include "packet-isis-clv.h"
@@ -3429,6 +3430,7 @@ dissect_srv6_sid_struct_subsubclv(tvbuff_t *tvb, packet_info* pinfo,
*/
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_sub_clv_tlv_22_22_23_141_222_223(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree,
int offset, int subclvs_len)
{
@@ -3446,6 +3448,8 @@ dissect_sub_clv_tlv_22_22_23_141_222_223(tvbuff_t *tvb, packet_info* pinfo, prot
proto_tree *subsubtree = NULL;
proto_item *ti_subsubtree = NULL;
+ increment_dissection_depth(pinfo);
+
while (i < subclvs_len) {
/* offset for each sub-TLV */
sub_tlv_offset = offset + i;
@@ -3705,8 +3709,9 @@ dissect_sub_clv_tlv_22_22_23_141_222_223(tvbuff_t *tvb, packet_info* pinfo, prot
proto_tree_add_item(subtree, hf_isis_lsp_ext_is_reachability_value, tvb, sub_tlv_offset, clv_len, ENC_NA);
break;
}
- i += clv_len + 2;
- }
+ i += clv_len + 2;
+ }
+ decrement_dissection_depth(pinfo);
}
diff --git a/epan/dissectors/packet-iso15765.c b/epan/dissectors/packet-iso15765.c
index bd3ff614..b27dc7ca 100644
--- a/epan/dissectors/packet-iso15765.c
+++ b/epan/dissectors/packet-iso15765.c
@@ -871,10 +871,17 @@ dissect_iso15765_can(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void*
return 0;
}
- if (can_info.fd) {
+ switch (can_info.fd) {
+
+ case CAN_TYPE_CAN_FD:
return dissect_iso15765(tvb, pinfo, tree, ISO15765_TYPE_CAN_FD, can_info.id, can_info.len);
- } else {
+
+ case CAN_TYPE_CAN_CLASSIC:
return dissect_iso15765(tvb, pinfo, tree, ISO15765_TYPE_CAN, can_info.id, can_info.len);
+
+ default:
+ DISSECTOR_ASSERT_NOT_REACHED();
+ return tvb_captured_length(tvb);
}
}
diff --git a/epan/dissectors/packet-iso7816.c b/epan/dissectors/packet-iso7816.c
index 7f071fc9..dbf7276d 100644
--- a/epan/dissectors/packet-iso7816.c
+++ b/epan/dissectors/packet-iso7816.c
@@ -634,18 +634,20 @@ dissect_iso7816_cmd_apdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
ret = dissect_iso7816_class(tvb, offset, pinfo, tree);
- if (ret==-1) {
+ if (ret == -1) {
/* the class byte says that the remaining APDU is not
in ISO7816 format */
- iso7816_trans->handle =
- dissector_get_payload_handle(iso7816_apdu_pld_table);
- if (iso7816_trans->handle != NULL) {
- ret = call_dissector(iso7816_trans->handle, tvb, pinfo, tree);
- if (ret == 0) {
- col_append_sep_str(pinfo->cinfo, COL_INFO, NULL,
- "Command APDU using proprietary format");
- return 1; /* we only dissected the class byte */
+ if (iso7816_trans) {
+ iso7816_trans->handle =
+ dissector_get_payload_handle(iso7816_apdu_pld_table);
+ if (iso7816_trans->handle != NULL) {
+ ret = call_dissector(iso7816_trans->handle, tvb, pinfo, tree);
+ if (ret == 0) {
+ col_append_sep_str(pinfo->cinfo, COL_INFO, NULL,
+ "Command APDU using proprietary format");
+ return 1; /* we only dissected the class byte */
+ }
}
}
diff --git a/epan/dissectors/packet-isup.c b/epan/dissectors/packet-isup.c
index be5060b7..67dac0ec 100644
--- a/epan/dissectors/packet-isup.c
+++ b/epan/dissectors/packet-isup.c
@@ -9723,6 +9723,7 @@ dissect_japan_chg_inf(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *isu
}
/* ------------------------------------------------------------------ */
+// NOLINTBEGIN(misc-no-recursion)
static void
dissect_ansi_isup_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *isup_tree, guint8 itu_isup_variant, guint32 circuit_id)
{
@@ -9739,6 +9740,9 @@ dissect_ansi_isup_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree
tap_calling_number = NULL;
offset = 0;
+ // We call ourselves for MESSAGE_TYPE_PASS_ALONG.
+ increment_dissection_depth(pinfo);
+
/* Extract message type field */
message_type = tvb_get_guint8(message_tvb, 0);
@@ -9991,8 +9995,12 @@ dissect_ansi_isup_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree
tap_rec->called_number = tap_called_number;
tap_rec->cause_value = tap_cause_value;
tap_queue_packet(isup_tap, pinfo, tap_rec);
+
+ decrement_dissection_depth(pinfo);
}
+// NOLINTEND(misc-no-recursion)
+// NOLINTBEGIN(misc-no-recursion)
static void
dissect_isup_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *isup_tree, guint8 itu_isup_variant, guint32 circuit_id)
{
@@ -10009,6 +10017,9 @@ dissect_isup_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *isup
tap_calling_number = NULL;
offset = 0;
+ // We call ourselves for MESSAGE_TYPE_PASS_ALONG.
+ increment_dissection_depth(pinfo);
+
/* Extract message type field */
message_type = tvb_get_guint8(message_tvb, 0);
@@ -10360,7 +10371,10 @@ dissect_isup_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *isup
tap_rec->called_number = tap_called_number;
tap_rec->cause_value = tap_cause_value;
tap_queue_packet(isup_tap, pinfo, tap_rec);
+
+ decrement_dissection_depth(pinfo);
}
+// NOLINTEND(misc-no-recursion)
/* ------------------------------------------------------------------ */
static int
diff --git a/epan/dissectors/packet-its.c b/epan/dissectors/packet-its.c
index d40d5afe..a651376c 100644
--- a/epan/dissectors/packet-its.c
+++ b/epan/dissectors/packet-its.c
@@ -14082,7 +14082,6 @@ static int dissect_AddGrpC_SignalStatusPackage_addGrpC_PDU(tvbuff_t *tvb _U_, pa
static int dissect_gdd_GddStructure(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
-#define MAX_RECURSION_DEPTH 100 // Arbitrarily chosen.
static int
@@ -14999,15 +14998,14 @@ static const per_sequence_t gdd_GddStructure_sequence[] = {
static int
dissect_gdd_GddStructure(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 9;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // GddStructure → GddAttributes → GddAttributes/_item → InternationalSign-destinationInformation → InternationalSign-destinationInformation/ioList → DestinationInformationIO → DestinationInformationIO/destPlace → DestinationPlace → GddStructure
+ actx->pinfo->dissection_depth += 8;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_per_sequence(tvb, offset, actx, tree, hf_index,
ett_gdd_GddStructure, gdd_GddStructure_sequence);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 8;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
diff --git a/epan/dissectors/packet-json_3gpp.c b/epan/dissectors/packet-json_3gpp.c
index 662df5b0..8cb4cadb 100644
--- a/epan/dissectors/packet-json_3gpp.c
+++ b/epan/dissectors/packet-json_3gpp.c
@@ -271,6 +271,9 @@ dissect_3gpp_supportfeatures(tvbuff_t* tvb, proto_tree* tree, packet_info* pinfo
}
ti = proto_tree_add_item(tree, hf_json_3gpp_suppfeat, tvb, offset, len, ENC_ASCII);
+ if (len <= 0) {
+ return;
+ }
sub_tree = proto_item_add_subtree(ti, ett_json_3gpp_data);
suppfeat_tvb = tvb_new_subset_length(tvb, offset, len);
diff --git a/epan/dissectors/packet-jxta.c b/epan/dissectors/packet-jxta.c
index 2f020ce8..a6b44d70 100644
--- a/epan/dissectors/packet-jxta.c
+++ b/epan/dissectors/packet-jxta.c
@@ -1461,6 +1461,7 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree
* the packet was not recognized as a JXTA packet and negative if the
* dissector needs more bytes in order to process a PDU.
**/
+// NOLINTNEXTLINE(misc-no-recursion)
static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, guint ns_count,
const gchar ** names_table)
{
@@ -1591,7 +1592,9 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p
jxta_signature_element_tvb = tvb_new_subset_remaining(tvb, offset);
+ increment_dissection_depth(pinfo);
processed = dissect_jxta_message_element_1(jxta_signature_element_tvb, pinfo, NULL, 0, NULL);
+ decrement_dissection_depth(pinfo);
if (processed == 0) {
return offset;
@@ -1685,7 +1688,9 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p
if ((flags & JXTAMSG1_ELMFLAG_SIGNATURE) != 0) {
tvbuff_t *jxta_message_element_tvb = tvb_new_subset_remaining(tvb, tree_offset);
+ increment_dissection_depth(pinfo);
tree_offset += dissect_jxta_message_element_1(jxta_message_element_tvb, pinfo, jxta_elem_tree, ns_count, names_table);
+ decrement_dissection_depth(pinfo);
}
proto_item_set_end(jxta_elem_tree_item, tvb, tree_offset);
@@ -1709,6 +1714,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p
* the packet was not recognized as a JXTA packet and negative if the
* dissector needs more bytes in order to process a PDU.
**/
+// NOLINTNEXTLINE(misc-no-recursion)
static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, guint names_count,
const gchar ** names_table)
{
@@ -1848,7 +1854,9 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p
jxta_signature_element_tvb = tvb_new_subset_remaining(tvb, offset);
+ increment_dissection_depth(pinfo);
processed = dissect_jxta_message_element_2(jxta_signature_element_tvb, pinfo, NULL, 0, NULL);
+ decrement_dissection_depth(pinfo);
if (processed == 0) {
return offset;
@@ -2014,6 +2022,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p
* the packet was not recognized and negative if the dissector needs
* more bytes in order to process a PDU.
**/
+// NOLINTNEXTLINE(misc-no-recursion)
static int dissect_media( const gchar* fullmediatype, tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) {
int dissected = 0;
@@ -2047,7 +2056,9 @@ static int dissect_media( const gchar* fullmediatype, tvbuff_t * tvb, packet_inf
add_new_data_source(pinfo, uncomp_tvb, "Uncompressed Element Content");
/* XXX bondolo 20060201 Force XML for uncompressed data. */
+ increment_dissection_depth(pinfo);
dissected = dissect_media("text/xml;charset=\"UTF-8\"", uncomp_tvb, pinfo, tree);
+ decrement_dissection_depth(pinfo);
if( dissected > 0 ) {
/* report back the uncompressed length. */
diff --git a/epan/dissectors/packet-kafka.c b/epan/dissectors/packet-kafka.c
index 798f1c95..482a6701 100644
--- a/epan/dissectors/packet-kafka.c
+++ b/epan/dissectors/packet-kafka.c
@@ -1907,6 +1907,7 @@ decompress(tvbuff_t *tvb, packet_info *pinfo, int offset, guint32 length, int co
* returns: pointer to the next message/batch
*/
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_kafka_message_old(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int end_offset _U_)
{
proto_item *message_ti;
@@ -2000,6 +2001,7 @@ dissect_kafka_message_old(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i
* returns: pointer to the next message/batch
*/
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_kafka_message_new(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int end_offset _U_)
{
proto_item *batch_ti;
@@ -2073,6 +2075,7 @@ dissect_kafka_message_new(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_kafka_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int end_offset)
{
gint8 magic_byte;
@@ -2093,14 +2096,19 @@ dissect_kafka_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o
}
magic_byte = tvb_get_guint8(tvb, offset + 16);
+ int message_offset = 0;
+ increment_dissection_depth(pinfo);
if (magic_byte < 2) {
- return dissect_kafka_message_old(tvb, pinfo, tree, offset, end_offset);
+ message_offset = dissect_kafka_message_old(tvb, pinfo, tree, offset, end_offset);
} else {
- return dissect_kafka_message_new(tvb, pinfo, tree, offset, end_offset);
+ message_offset = dissect_kafka_message_new(tvb, pinfo, tree, offset, end_offset);
}
+ decrement_dissection_depth(pinfo);
+ return message_offset;
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_kafka_message_set(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, guint len, guint8 codec)
{
proto_item *ti;
diff --git a/epan/dissectors/packet-kerberos.c b/epan/dissectors/packet-kerberos.c
index 34a5408f..024d2192 100644
--- a/epan/dissectors/packet-kerberos.c
+++ b/epan/dissectors/packet-kerberos.c
@@ -2508,7 +2508,7 @@ verify_krb5_pac_ticket_checksum(proto_tree *tree _U_,
}
checksum.length = MIN(checksum.length, (unsigned int)checksum_length);
- tepdata.data = (void *)(uintptr_t)tepbuffer;
+ tepdata.data = (void *)tepbuffer;
tepdata.length = teplength;
ret = decode_krb5_enc_tkt_part(&tepdata, &tep);
diff --git a/epan/dissectors/packet-kink.c b/epan/dissectors/packet-kink.c
index 7c19b1da..87c7fd65 100644
--- a/epan/dissectors/packet-kink.c
+++ b/epan/dissectors/packet-kink.c
@@ -275,6 +275,7 @@ dissect_kink(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
* This function called by the respective function again.
*/
static void
+// NOLINTNEXTLINE(misc-no-recursion)
control_payload(packet_info *pinfo, tvbuff_t *tvb, int offset, guint8 next_payload, proto_tree *kink_tree){
switch(next_payload){
case KINK_DONE:
@@ -310,6 +311,7 @@ control_payload(packet_info *pinfo, tvbuff_t *tvb, int offset, guint8 next_paylo
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_payload_kink_ap_req(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree){
proto_tree *payload_kink_ap_req_tree;
proto_item *ti;
@@ -365,6 +367,7 @@ dissect_payload_kink_ap_req(packet_info *pinfo, tvbuff_t *tvb, int offset, proto
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_payload_kink_ap_rep(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree){
proto_tree *payload_kink_ap_rep_tree;
proto_item *ti;
@@ -420,6 +423,7 @@ dissect_payload_kink_ap_rep(packet_info *pinfo, tvbuff_t *tvb, int offset, proto
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_payload_kink_krb_error(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree){
proto_tree *payload_kink_krb_error_tree;
proto_item *ti;
@@ -472,6 +476,7 @@ dissect_payload_kink_krb_error(packet_info *pinfo, tvbuff_t *tvb, int offset, pr
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_payload_kink_tgt_req(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree){
proto_tree *payload_kink_tgt_req_tree;
guint8 next_payload;
@@ -514,6 +519,7 @@ dissect_payload_kink_tgt_req(packet_info *pinfo, tvbuff_t *tvb, int offset, prot
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_payload_kink_tgt_rep(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree){
proto_tree *payload_kink_tgt_rep_tree;
guint8 next_payload;
@@ -572,6 +578,7 @@ dissect_payload_kink_tgt_rep(packet_info *pinfo, tvbuff_t *tvb, int offset, prot
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_payload_kink_isakmp(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree){
proto_tree *payload_kink_isakmp_tree;
proto_item *ti;
@@ -636,6 +643,7 @@ dissect_payload_kink_isakmp(packet_info *pinfo, tvbuff_t *tvb, int offset, proto
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_payload_kink_encrypt(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree){
proto_tree *payload_kink_encrypt_tree;
proto_item *ti;
@@ -714,6 +722,7 @@ dissect_payload_kink_encrypt(packet_info *pinfo, tvbuff_t *tvb, int offset, prot
#ifdef HAVE_KERBEROS
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_decrypt_kink_encrypt(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree, int payload_length){
proto_tree *decrypt_kink_encrypt_tree;
@@ -750,6 +759,7 @@ static const range_string kink_error_rvals[] = {
};
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_payload_kink_error(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree){
proto_tree *payload_kink_error_tree;
proto_item *ti;
@@ -784,6 +794,7 @@ dissect_payload_kink_error(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_payload_kink_not_defined(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree *tree){
proto_tree *payload_kink_not_defined_tree;
guint8 next_payload;
@@ -980,6 +991,7 @@ proto_register_kink(void) {
}
void proto_reg_handoff_kink(void) {
+ // If this is ever streamed (transported over TCP) we need to add recursion checks.
dissector_add_uint_with_preference("udp.port", KINK_PORT, kink_handle);
}
diff --git a/epan/dissectors/packet-knxip.c b/epan/dissectors/packet-knxip.c
index cb7d5ec6..15f13d44 100644
--- a/epan/dissectors/packet-knxip.c
+++ b/epan/dissectors/packet-knxip.c
@@ -2646,6 +2646,7 @@ static void make_key_info( gchar* text, gint text_max, const guint8* key, const
/* Dissect SECURE_WRAPPER
*/
+// NOLINTNEXTLINE(misc-no-recursion)
static guint8 dissect_secure_wrapper( guint8 header_length, tvbuff_t* tvb, packet_info* pinfo, proto_tree* root, proto_item* item, proto_tree* tree, gint* p_offset )
{
guint8 ok = 1;
@@ -2803,7 +2804,9 @@ static guint8 dissect_secure_wrapper( guint8 header_length, tvbuff_t* tvb, packe
/* Dissect embedded KIP packet */
{
tvbuff_t* tvb3 = tvb_new_subset_length( tvb2, 0, size2 );
+ increment_dissection_depth(pinfo);
dissect_knxip( tvb3, pinfo, root, NULL );
+ decrement_dissection_depth(pinfo);
}
}
}
@@ -3177,6 +3180,7 @@ static guint8 dissect_session_status( tvbuff_t* tvb, packet_info* pinfo, proto_i
/* Dissect KNX-IP data after KNX-IP header
*/
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_knxip_data( guint8 header_length, guint8 protocol_version _U_, guint16 service, tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, proto_item* kip_item, proto_tree* kip_tree )
{
guint8 ok = 1;
@@ -3740,6 +3744,7 @@ get_knxip_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data
return tvb_get_ntohs( tvb, offset+4 );
}
+// NOLINTNEXTLINE(misc-no-recursion)
static gint dissect_knxip( tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data _U_ )
{
gint offset = 0;
diff --git a/epan/dissectors/packet-ldap.c b/epan/dissectors/packet-ldap.c
index 1ad92152..42834ced 100644
--- a/epan/dissectors/packet-ldap.c
+++ b/epan/dissectors/packet-ldap.c
@@ -1115,7 +1115,6 @@ ldap_match_call_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu
static int dissect_ldap_Filter(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
-#define MAX_RECURSION_DEPTH 100 // Arbitrarily chosen.
static int
@@ -2174,11 +2173,9 @@ static const ber_choice_t Filter_choice[] = {
static int
dissect_ldap_Filter(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 4;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // Filter → Filter/and → Filter/and/_item → Filter
+ actx->pinfo->dissection_depth += 3;
+ increment_dissection_depth(actx->pinfo);
proto_tree *tr;
proto_item *it;
attributedesc_string=NULL;
@@ -2204,7 +2201,8 @@ dissect_ldap_Filter(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, as
proto_item_append_text(it, "%s", string_or_null(Filter_string));
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 3;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
diff --git a/epan/dissectors/packet-ldp.c b/epan/dissectors/packet-ldp.c
index e4114f39..25daf89d 100644
--- a/epan/dissectors/packet-ldp.c
+++ b/epan/dissectors/packet-ldp.c
@@ -2433,6 +2433,7 @@ static int
dissect_tlv(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem);
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_tlv_er(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
proto_tree *val_tree;
@@ -2514,6 +2515,7 @@ dissect_tlv_upstrm_ass_lbl(tvbuff_t *tvb, packet_info *pinfo, guint offset, prot
}
/*Dissect IPv4 Interface ID TLV*/
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_tlv_ipv4_interface_id(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
proto_tree *val_tree, *sub_tree;
@@ -2558,6 +2560,7 @@ dissect_tlv_ip_multicast_tunnel(tvbuff_t *tvb, guint offset, proto_tree *tree, i
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_tlv_mpls_context_lbl(tvbuff_t *tvb,packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
proto_tree *val_tree;
@@ -2594,6 +2597,7 @@ dissect_tlv_rsvp_te_p2mp_lsp(tvbuff_t *tvb, guint offset, proto_tree *tree)
/* Dissect a TLV and return the number of bytes consumed ... */
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_tlv(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
guint16 type, typebak;
@@ -2616,6 +2620,8 @@ dissect_tlv(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, i
rem -= 4; /*do not count header*/
length = MIN(length, rem); /* Don't go haywire if a problem ... */
+ increment_dissection_depth(pinfo);
+
if (tree) {
proto_tree *tlv_tree;
/*chk for vendor-private*/
@@ -3000,6 +3006,7 @@ dissect_tlv(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, i
}
}
+ decrement_dissection_depth(pinfo);
return length + 4; /* Length of the value field + header */
}
diff --git a/epan/dissectors/packet-li5g.c b/epan/dissectors/packet-li5g.c
index f9950c06..af930f46 100644
--- a/epan/dissectors/packet-li5g.c
+++ b/epan/dissectors/packet-li5g.c
@@ -100,6 +100,7 @@ static const value_string attribute_type_vals[] = {
};
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_li5g(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_tree *li5g_tree, *attr_tree, *parent=NULL;
@@ -171,8 +172,11 @@ dissect_li5g(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
li5g_tree->parent=parent;
/* have another li5g in the same packet? */
- if (tvb_captured_length(tvb)>offset+payloadLen)
+ if (tvb_captured_length(tvb)>offset+payloadLen) {
+ increment_dissection_depth(pinfo);
dissect_li5g(tvb_new_subset_remaining(tvb, offset+payloadLen), pinfo, tree, NULL);
+ decrement_dissection_depth(pinfo);
+ }
/* set these info at the end*/
col_set_str(pinfo->cinfo, COL_PROTOCOL, "5GLI");
diff --git a/epan/dissectors/packet-lisp-tcp.c b/epan/dissectors/packet-lisp-tcp.c
index f05e2bbf..108e9f58 100644
--- a/epan/dissectors/packet-lisp-tcp.c
+++ b/epan/dissectors/packet-lisp-tcp.c
@@ -150,7 +150,7 @@ dissect_lisp_tcp_message_eid_prefix(tvbuff_t *tvb, packet_info *pinfo, proto_tre
prefix_length = tvb_get_guint8(tvb, offset);
prefix_afi = tvb_get_ntohs(tvb, offset + 1);
- prefix = get_addr_str(pinfo->pool, tvb, offset + 3, prefix_afi, &addr_len);
+ prefix = get_addr_str(tvb, pinfo, offset + 3, prefix_afi, &addr_len);
if (prefix == NULL) {
expert_add_info_format(pinfo, message_tree, &ei_lisp_tcp_unexpected_afi,
diff --git a/epan/dissectors/packet-lisp.c b/epan/dissectors/packet-lisp.c
index 6eb7db4d..56f9a3ec 100644
--- a/epan/dissectors/packet-lisp.c
+++ b/epan/dissectors/packet-lisp.c
@@ -515,7 +515,8 @@ get_lcaf_data(tvbuff_t *tvb, gint offset, guint8 *lcaf_type, guint16 *len)
}
const gchar *
-get_addr_str(wmem_allocator_t *pool, tvbuff_t *tvb, gint offset, guint16 afi, guint16 *addr_len)
+// NOLINTNEXTLINE(misc-no-recursion)
+get_addr_str(tvbuff_t *tvb, packet_info *pinfo, gint offset, guint16 afi, guint16 *addr_len)
{
const gchar *notset_str = "not set";
const gchar *addr_str;
@@ -529,11 +530,11 @@ get_addr_str(wmem_allocator_t *pool, tvbuff_t *tvb, gint offset, guint16 afi, gu
return notset_str;
case AFNUM_INET:
*addr_len = INET_ADDRLEN;
- addr_str = tvb_ip_to_str(pool, tvb, offset);
+ addr_str = tvb_ip_to_str(pinfo->pool, tvb, offset);
return addr_str;
case AFNUM_INET6:
*addr_len = INET6_ADDRLEN;
- addr_str = tvb_ip6_to_str(pool, tvb, offset);
+ addr_str = tvb_ip6_to_str(pinfo->pool, tvb, offset);
return addr_str;
case AFNUM_LCAF:
get_lcaf_data(tvb, offset, &lcaf_type, addr_len);
@@ -541,24 +542,28 @@ get_addr_str(wmem_allocator_t *pool, tvbuff_t *tvb, gint offset, guint16 afi, gu
if (lcaf_type == LCAF_IID) {
iid = tvb_get_ntohl(tvb, offset + LCAF_HEADER_LEN);
afi = tvb_get_ntohs(tvb, offset + LCAF_HEADER_LEN + 4);
- addr_str = get_addr_str(pool, tvb, offset + LCAF_HEADER_LEN + 6, afi, &cur_len);
- return wmem_strdup_printf(pool, "[%d] %s", iid, addr_str);
+ increment_dissection_depth(pinfo);
+ addr_str = get_addr_str(tvb, pinfo, offset + LCAF_HEADER_LEN + 6, afi, &cur_len);
+ decrement_dissection_depth(pinfo);
+ return wmem_strdup_printf(pinfo->pool, "[%d] %s", iid, addr_str);
}
if (lcaf_type == LCAF_ASN) {
asn = tvb_get_ntohl(tvb, offset + LCAF_HEADER_LEN);
afi = tvb_get_ntohs(tvb, offset + LCAF_HEADER_LEN + 4);
- addr_str = get_addr_str(pool, tvb, offset + LCAF_HEADER_LEN + 6, afi, &cur_len);
- return wmem_strdup_printf(pool, "%s (ASN %d)", addr_str, asn);
+ increment_dissection_depth(pinfo);
+ addr_str = get_addr_str(tvb, pinfo, offset + LCAF_HEADER_LEN + 6, afi, &cur_len);
+ decrement_dissection_depth(pinfo);
+ return wmem_strdup_printf(pinfo->pool, "%s (ASN %d)", addr_str, asn);
}
return addr_str;
case AFNUM_802:
case AFNUM_EUI48:
*addr_len = EUI48_ADDRLEN;
- addr_str = tvb_ether_to_str(pool, tvb, offset);
+ addr_str = tvb_ether_to_str(pinfo->pool, tvb, offset);
return addr_str;
case AFNUM_DISTNAME:
*addr_len = tvb_strsize(tvb, offset);
- addr_str = tvb_get_stringz_enc(pool, tvb, offset, NULL, ENC_ASCII);
+ addr_str = tvb_get_stringz_enc(pinfo->pool, tvb, offset, NULL, ENC_ASCII);
return addr_str;
default:
return NULL;
@@ -566,6 +571,7 @@ get_addr_str(wmem_allocator_t *pool, tvbuff_t *tvb, gint offset, guint16 afi, gu
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_lcaf_natt_rloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gint offset, const gchar *str, int idx)
{
@@ -584,7 +590,7 @@ dissect_lcaf_natt_rloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += 2;
/* Reencap hop */
- rloc_str = get_addr_str(pinfo->pool, tvb, offset, rloc_afi, &addr_len);
+ rloc_str = get_addr_str(tvb, pinfo, offset, rloc_afi, &addr_len);
switch (rloc_afi) {
case AFNUM_RESERVED:
@@ -616,6 +622,7 @@ dissect_lcaf_natt_rloc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_lcaf_elp_hop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gint offset, int idx, proto_item *tip)
{
@@ -646,7 +653,7 @@ dissect_lcaf_elp_hop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += 2;
/* Reencap hop */
- hop_str = get_addr_str(pinfo->pool, tvb, offset, hop_afi, &addr_len);
+ hop_str = get_addr_str(tvb, pinfo, offset, hop_afi, &addr_len);
switch (hop_afi) {
case AFNUM_INET:
@@ -688,6 +695,7 @@ dissect_lcaf_elp_hop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_lcaf_rle_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gint offset, int idx, proto_item *tip)
{
@@ -716,7 +724,7 @@ dissect_lcaf_rle_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += 2;
/* RTR/ETR entry */
- entry_str = get_addr_str(pinfo->pool, tvb, offset, entry_afi, &addr_len);
+ entry_str = get_addr_str(tvb, pinfo, offset, entry_afi, &addr_len);
switch (entry_afi) {
case AFNUM_INET:
@@ -756,6 +764,7 @@ dissect_lcaf_rle_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
*/
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_lcaf_afi_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gint offset, guint16 length)
{
@@ -796,7 +805,7 @@ dissect_lcaf_afi_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case AFNUM_LCAF:
old_offset = offset;
- lcaf_str = get_addr_str(pinfo->pool, tvb, offset, afi, &addr_len);
+ lcaf_str = get_addr_str(tvb, pinfo, offset, afi, &addr_len);
proto_item_append_text(tir, " %d. %s", i, lcaf_str);
proto_item_set_len(tir, 2 + addr_len);
offset = dissect_lcaf(tvb, pinfo, lisp_afi_list_tree, offset, tir);
@@ -848,6 +857,7 @@ dissect_lcaf_afi_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
*/
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_lcaf_iid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, proto_item *tip)
{
const gchar *ip_address;
@@ -865,7 +875,7 @@ dissect_lcaf_iid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offse
offset += 2;
/* Address */
- ip_address = get_addr_str(pinfo->pool, tvb, offset, afi, &addr_len);
+ ip_address = get_addr_str(tvb, pinfo, offset, afi, &addr_len);
if (ip_address && afi)
proto_item_append_text(tip, ", Address: %s", ip_address);
@@ -922,6 +932,7 @@ dissect_lcaf_iid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offse
*/
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_lcaf_asn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, proto_item *tip)
{
const gchar *addr;
@@ -939,7 +950,7 @@ dissect_lcaf_asn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offse
offset += 2;
/* Address */
- addr = get_addr_str(pinfo->pool, tvb, offset, afi, &addr_len);
+ addr = get_addr_str(tvb, pinfo, offset, afi, &addr_len);
if (addr && afi)
proto_item_append_text(tip, ", Address: %s", addr);
@@ -1000,6 +1011,7 @@ dissect_lcaf_asn(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offse
*/
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_lcaf_geo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, proto_item *tir)
{
guint16 addr_len = 0;
@@ -1108,7 +1120,7 @@ dissect_lcaf_geo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offse
proto_tree_add_item(tree, hf_lisp_lcaf_geo_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
- ip_address = get_addr_str(pinfo->pool, tvb, offset, afi, &addr_len);
+ ip_address = get_addr_str(tvb, pinfo, offset, afi, &addr_len);
if (ip_address && afi)
proto_item_append_text(tir, ", Address: %s", ip_address);
@@ -1235,6 +1247,7 @@ dissect_lcaf_natt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
*/
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_lcaf_nonce_loc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, proto_item *tip)
{
const gchar *addr;
@@ -1257,7 +1270,7 @@ dissect_lcaf_nonce_loc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint
offset += 2;
/* Address */
- addr = get_addr_str(pinfo->pool, tvb, offset, afi, &addr_len);
+ addr = get_addr_str(tvb, pinfo, offset, afi, &addr_len);
if (addr && afi)
proto_item_append_text(tip, ", Address: %s", addr);
@@ -1318,6 +1331,7 @@ dissect_lcaf_nonce_loc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint
*/
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_lcaf_mcast_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gint offset, proto_item *tir)
{
@@ -1356,7 +1370,7 @@ dissect_lcaf_mcast_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += 2;
/* Source/Subnet Address */
- src_str = get_addr_str(pinfo->pool, tvb, offset, afi, &addr_len);
+ src_str = get_addr_str(tvb, pinfo, offset, afi, &addr_len);
switch (afi) {
case AFNUM_INET:
@@ -1389,7 +1403,7 @@ dissect_lcaf_mcast_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += 2;
/* Group Address */
- grp_str = get_addr_str(pinfo->pool, tvb, offset, afi, &addr_len);
+ grp_str = get_addr_str(tvb, pinfo, offset, afi, &addr_len);
switch (afi) {
case AFNUM_INET:
@@ -1479,6 +1493,7 @@ dissect_lcaf_elp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
*/
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_lcaf_src_dst_key(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gint offset, proto_item *tir)
{
@@ -1511,7 +1526,7 @@ dissect_lcaf_src_dst_key(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += 2;
/* Source Prefix */
- src_str = get_addr_str(pinfo->pool, tvb, offset, afi, &addr_len);
+ src_str = get_addr_str(tvb, pinfo, offset, afi, &addr_len);
switch (afi) {
case AFNUM_INET:
@@ -1550,7 +1565,7 @@ dissect_lcaf_src_dst_key(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += 2;
/* Destination Prefix */
- dst_str = get_addr_str(pinfo->pool, tvb, offset, afi, &addr_len);
+ dst_str = get_addr_str(tvb, pinfo, offset, afi, &addr_len);
switch (afi) {
case AFNUM_INET:
@@ -1643,6 +1658,7 @@ dissect_lcaf_rle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
*/
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_lcaf_kv_addr_pair(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gint offset)
{
@@ -1661,7 +1677,7 @@ dissect_lcaf_kv_addr_pair(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += 2;
/* Key */
- key_str = get_addr_str(pinfo->pool, tvb, offset, afi, &addr_len);
+ key_str = get_addr_str(tvb, pinfo, offset, afi, &addr_len);
switch (afi) {
case AFNUM_INET:
@@ -1705,7 +1721,7 @@ dissect_lcaf_kv_addr_pair(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += 2;
/* Value */
- value_str = get_addr_str(pinfo->pool, tvb, offset, afi, &addr_len);
+ value_str = get_addr_str(tvb, pinfo, offset, afi, &addr_len);
switch (afi) {
case AFNUM_INET:
@@ -1821,6 +1837,7 @@ dissect_lcaf_vendor(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
*/
int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_lcaf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, proto_item *tip)
{
guint8 lcaf_type;
@@ -1875,6 +1892,7 @@ dissect_lcaf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, p
payload_tvb = tvb_new_subset_length(tvb, 0, offset + len);
ti = (tip) ? tip : tir;
+ increment_dissection_depth(pinfo);
switch (lcaf_type) {
case LCAF_NULL:
break;
@@ -1918,6 +1936,7 @@ dissect_lcaf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, p
proto_tree_add_expert(tree, pinfo, &ei_lisp_undecoded, tvb, offset, len);
return offset + len;
}
+ decrement_dissection_depth(pinfo);
return offset;
}
@@ -1985,7 +2004,7 @@ dissect_lisp_locator(tvbuff_t *tvb, packet_info *pinfo, proto_tree *lisp_mapping
loc_afi = tvb_get_ntohs(tvb, offset);
offset += 2;
- locator = get_addr_str(pinfo->pool, tvb, offset, loc_afi, &addr_len);
+ locator = get_addr_str(tvb, pinfo, offset, loc_afi, &addr_len);
if (locator == NULL) {
expert_add_info_format(pinfo, lisp_mapping_tree, &ei_lisp_unexpected_field,
@@ -2054,7 +2073,7 @@ dissect_lisp_mapping(tvbuff_t *tvb, packet_info *pinfo, proto_tree *lisp_tree,
act = flags & LISP_MAP_ACT;
act >>= 13;
- prefix = get_addr_str(pinfo->pool, tvb, offset + 12, prefix_afi, &addr_len);
+ prefix = get_addr_str(tvb, pinfo, offset + 12, prefix_afi, &addr_len);
if (prefix == NULL) {
expert_add_info_format(pinfo, lisp_tree, &ei_lisp_unexpected_field,
@@ -2290,7 +2309,7 @@ dissect_lisp_map_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *lisp_tre
offset += INET6_ADDRLEN;
break;
case AFNUM_LCAF:
- src_eid = get_addr_str(pinfo->pool, tvb, offset, src_eid_afi, &addr_len);
+ src_eid = get_addr_str(tvb, pinfo, offset, src_eid_afi, &addr_len);
lcaf_src_eid_tree = proto_tree_add_subtree_format(lisp_tree, tvb, offset, addr_len, ett_lisp_lcaf, NULL, "Source EID: %s", src_eid);
dissect_lcaf(tvb, pinfo, lcaf_src_eid_tree, offset, NULL);
offset += addr_len;
@@ -2355,7 +2374,7 @@ dissect_lisp_map_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *lisp_tre
addr_len = 0;
prefix_mask = tvb_get_guint8(tvb, offset + 1);
prefix_afi = tvb_get_ntohs(tvb, offset + 2);
- prefix = get_addr_str(pinfo->pool, tvb, offset + 4, prefix_afi, &addr_len);
+ prefix = get_addr_str(tvb, pinfo, offset + 4, prefix_afi, &addr_len);
if (prefix == NULL) {
expert_add_info_format(pinfo, lisp_tree, &ei_lisp_unexpected_field,
@@ -2879,7 +2898,7 @@ dissect_lisp_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *lisp_tree)
proto_tree_add_item(prefix_tree, hf_lisp_info_prefix_afi, tvb, offset, 2, ENC_BIG_ENDIAN);
prefix_afi = tvb_get_ntohs(tvb, offset); offset += 2;
- prefix = get_addr_str(pinfo->pool, tvb, offset, prefix_afi, &addr_len);
+ prefix = get_addr_str(tvb, pinfo, offset, prefix_afi, &addr_len);
if (prefix == NULL) {
expert_add_info_format(pinfo, lisp_tree, &ei_lisp_unexpected_field,
diff --git a/epan/dissectors/packet-lisp.h b/epan/dissectors/packet-lisp.h
index b85a647a..5a61c63a 100644
--- a/epan/dissectors/packet-lisp.h
+++ b/epan/dissectors/packet-lisp.h
@@ -22,7 +22,7 @@
#define LISP_CONTROL_PORT 4342
-const gchar * get_addr_str(wmem_allocator_t *pool, tvbuff_t *tvb, gint offset, guint16 afi, guint16 *addr_len);
+const gchar * get_addr_str(tvbuff_t *tvb, packet_info *pinfo, gint offset, guint16 afi, guint16 *addr_len);
int dissect_lcaf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, proto_item *tip);
int dissect_lisp_mapping(tvbuff_t *tvb, packet_info *pinfo, proto_tree *lisp_tree,
guint8 rec_cnt, int rec, gboolean referral, gint offset, proto_item *tim);
diff --git a/epan/dissectors/packet-llrp.c b/epan/dissectors/packet-llrp.c
index 9b02b072..4e97b53c 100644
--- a/epan/dissectors/packet-llrp.c
+++ b/epan/dissectors/packet-llrp.c
@@ -1519,6 +1519,7 @@ static guint dissect_llrp_item_array(tvbuff_t * const tvb, packet_info *pinfo,
}
static guint
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_llrp_impinj_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *param_tree,
guint suboffset, const guint param_end)
{
@@ -1806,6 +1807,7 @@ dissect_llrp_impinj_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *par
}
static guint
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_llrp_parameters(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint offset, const guint end, const guint depth)
{
@@ -1857,6 +1859,7 @@ dissect_llrp_parameters(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += 2;
suboffset = offset;
+ increment_dissection_depth(pinfo);
switch(type) {
case LLRP_TLV_RO_BOUND_SPEC:
case LLRP_TLV_UHF_CAPABILITIES:
@@ -2503,6 +2506,7 @@ dissect_llrp_parameters(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
break;
}
+ decrement_dissection_depth(pinfo);
/* Have we decoded exactly the number of bytes declared in the parameter? */
if(suboffset != param_end) {
/* Report problem */
@@ -2566,7 +2570,7 @@ dissect_llrp_parameters(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
* will already show up as 'unknown'. */
real_len = 0;
break;
- };
+ }
ti = proto_tree_add_none_format(tree, hf_llrp_param, tvb,
offset, real_len + 1, "TV Parameter : %s",
@@ -3996,8 +4000,7 @@ proto_register_llrp(void)
expert_module_t* expert_llrp;
/* Register the protocol name and description */
- proto_llrp = proto_register_protocol("Low Level Reader Protocol",
- "LLRP", "llrp");
+ proto_llrp = proto_register_protocol("Low Level Reader Protocol", "LLRP", "llrp");
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_llrp, hf, array_length(hf));
diff --git a/epan/dissectors/packet-lwm2mtlv.c b/epan/dissectors/packet-lwm2mtlv.c
index da5995fb..032a13f6 100644
--- a/epan/dissectors/packet-lwm2mtlv.c
+++ b/epan/dissectors/packet-lwm2mtlv.c
@@ -820,6 +820,7 @@ addValueInterpretations(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tlv_tree,
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
addValueTree(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tlv_tree, lwm2mElement_t *element, gint object_id, gint resource_id, const lwm2m_resource_t *resource)
{
guint valueOffset = 1 + element->length_of_identifier + element->length_of_length;
@@ -839,6 +840,7 @@ addValueTree(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tlv_tree, lwm2mEleme
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
addTlvElement(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tlv_tree, lwm2mElement_t *element, gint object_id, gint resource_id)
{
proto_tree *element_tree = NULL;
@@ -906,6 +908,7 @@ static guint parseTLVHeader(tvbuff_t *tvb, lwm2mElement_t *element)
return element->totalLength;
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void parseArrayOfElements(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tlv_tree, gint object_id, gint resource_id)
{
guint length;
@@ -916,6 +919,7 @@ static void parseArrayOfElements(packet_info *pinfo, tvbuff_t *tvb, proto_tree *
length = tvb_reported_length(tvb);
+ increment_dissection_depth(pinfo);
while ( length > 0 ) {
tvbuff_t* sub = tvb_new_subset_length(tvb, offset, length);
elementLength = parseTLVHeader(sub, &element);
@@ -932,6 +936,7 @@ static void parseArrayOfElements(packet_info *pinfo, tvbuff_t *tvb, proto_tree *
break;
}
}
+ decrement_dissection_depth(pinfo);
proto_item_append_text(tlv_tree, " (%u element%s)", element_count, plurality(element_count, "", "s"));
}
@@ -1170,11 +1175,7 @@ void proto_register_lwm2mtlv(void)
module_t *lwm2mtlv_module;
/* Register our configuration options */
- proto_lwm2mtlv = proto_register_protocol (
- "Lightweight M2M TLV",
- "LwM2M-TLV",
- "lwm2mtlv"
- );
+ proto_lwm2mtlv = proto_register_protocol ("Lightweight M2M TLV", "LwM2M-TLV","lwm2mtlv");
proto_register_field_array(proto_lwm2mtlv, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
diff --git a/epan/dissectors/packet-m2ua.c b/epan/dissectors/packet-m2ua.c
index 3e0e662a..e575ebad 100644
--- a/epan/dissectors/packet-m2ua.c
+++ b/epan/dissectors/packet-m2ua.c
@@ -655,6 +655,7 @@ dissect_retrieval_result_parameter(tvbuff_t *parameter_tvb, proto_tree *paramete
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_link_key_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@@ -702,6 +703,7 @@ dissect_sdl_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_registration_result_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@@ -745,6 +747,7 @@ dissect_registration_status_parameter(tvbuff_t *parameter_tvb, proto_tree *param
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_deregistration_result_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@@ -864,6 +867,7 @@ static const value_string parameter_tag_values[] = {
static gint protocol_data_1_global = PROTOCOL_DATA_1_PARAMETER_TAG;
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m2ua_tree)
{
guint16 tag, length, padding_length;
@@ -994,6 +998,7 @@ dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree,
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_parameters(tvbuff_t *parameters_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m2ua_tree)
{
gint offset, length, total_length, remaining_length;
@@ -1007,7 +1012,9 @@ dissect_parameters(tvbuff_t *parameters_tvb, packet_info *pinfo, proto_tree *tre
total_length = MIN(total_length, remaining_length);
/* create a tvb for the parameter including the padding bytes */
parameter_tvb = tvb_new_subset_length(parameters_tvb, offset, total_length);
+ increment_dissection_depth(pinfo);
dissect_parameter(parameter_tvb, pinfo, tree, m2ua_tree);
+ decrement_dissection_depth(pinfo);
/* get rid of the handled parameter */
offset += total_length;
}
diff --git a/epan/dissectors/packet-m3ua.c b/epan/dissectors/packet-m3ua.c
index 7ce880c6..73533fda 100644
--- a/epan/dissectors/packet-m3ua.c
+++ b/epan/dissectors/packet-m3ua.c
@@ -860,6 +860,7 @@ dissect_concerned_destination_parameter(tvbuff_t *parameter_tvb, proto_tree *par
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_routing_key_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@@ -900,6 +901,7 @@ dissect_v67_registration_result_parameter(tvbuff_t *parameter_tvb, proto_tree *p
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_registration_result_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@@ -933,6 +935,7 @@ dissect_v67_deregistration_result_parameter(tvbuff_t *parameter_tvb, proto_tree
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_deregistration_result_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@@ -1308,6 +1311,7 @@ dissect_deregistration_status_parameter(tvbuff_t *parameter_tvb, proto_tree *par
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_registration_results_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@@ -1319,6 +1323,7 @@ dissect_registration_results_parameter(tvbuff_t *parameter_tvb, packet_info *pin
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_deregistration_results_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@@ -1498,6 +1503,7 @@ static const value_string v6_parameter_tag_values[] = {
{ 0, NULL } };
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_v6_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m3ua_tree)
{
guint16 tag, length, padding_length;
@@ -1665,6 +1671,7 @@ static const value_string v7_parameter_tag_values[] = {
{ 0, NULL } };
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_v7_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m3ua_tree)
{
guint16 tag, length, padding_length;
@@ -1831,6 +1838,7 @@ static const value_string parameter_tag_values[] = {
{ 0, NULL } };
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m3ua_tree)
{
guint16 tag, length, padding_length;
@@ -1940,6 +1948,7 @@ dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree,
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_parameters(tvbuff_t *parameters_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m3ua_tree)
{
gint offset, length, total_length, remaining_length;
@@ -1953,6 +1962,7 @@ dissect_parameters(tvbuff_t *parameters_tvb, packet_info *pinfo, proto_tree *tre
total_length = MIN(total_length, remaining_length);
/* create a tvb for the parameter including the padding bytes */
parameter_tvb = tvb_new_subset_length(parameters_tvb, offset, total_length);
+ increment_dissection_depth(pinfo);
switch(version) {
case M3UA_V5:
dissect_v5_parameter(parameter_tvb, pinfo, tree, m3ua_tree);
@@ -1967,6 +1977,7 @@ dissect_parameters(tvbuff_t *parameters_tvb, packet_info *pinfo, proto_tree *tre
dissect_parameter(parameter_tvb, pinfo, tree, m3ua_tree);
break;
}
+ decrement_dissection_depth(pinfo);
/* get rid of the handled parameter */
offset += total_length;
}
@@ -1974,6 +1985,7 @@ dissect_parameters(tvbuff_t *parameters_tvb, packet_info *pinfo, proto_tree *tre
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_message(tvbuff_t *message_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *m3ua_tree)
{
tvbuff_t *common_header_tvb, *parameters_tvb;
diff --git a/epan/dissectors/packet-mac-lte.c b/epan/dissectors/packet-mac-lte.c
index e6c882fc..363a9bc5 100644
--- a/epan/dissectors/packet-mac-lte.c
+++ b/epan/dissectors/packet-mac-lte.c
@@ -3151,7 +3151,7 @@ static gint dissect_rar_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
proto_item *ul_grant_ti;
guint32 timing_advance;
guint32 ul_grant;
- guint16 temp_crnti;
+ guint32 temp_crnti;
const gchar *rapid_description;
guint32 bits_offset;
@@ -3356,7 +3356,7 @@ static gint dissect_rar_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
/* Temporary C-RNTI */
proto_tree_add_item_ret_uint(rar_body_tree, hf_mac_lte_rar_temporary_crnti, tvb, offset, 2,
- ENC_BIG_ENDIAN, (guint32*)&temp_crnti);
+ ENC_BIG_ENDIAN, &temp_crnti);
offset += 2;
rapid_description = get_mac_lte_rapid_description(rapid);
@@ -3379,6 +3379,7 @@ static void dissect_rar(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, pro
{
guint number_of_rars = 0; /* No of RAR bodies expected following headers */
guint8 *rapids = (guint8 *)wmem_alloc(pinfo->pool, MAX_RAR_PDUS * sizeof(guint8));
+ guint32 temp_rapid;
gboolean backoff_indicator_seen = FALSE;
guint32 backoff_indicator = 0;
guint8 extension;
@@ -3469,7 +3470,8 @@ static void dissect_rar(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, pro
const gchar *rapid_description;
proto_tree_add_item_ret_uint(rar_header_tree, hf_mac_lte_rar_rapid, tvb, offset, 1,
- ENC_BIG_ENDIAN, (guint32*)&rapids[number_of_rars]);
+ ENC_BIG_ENDIAN, &temp_rapid);
+ rapids[number_of_rars] = (guint8)temp_rapid;
rapid_description = get_mac_lte_rapid_description(rapids[number_of_rars]);
@@ -6260,7 +6262,7 @@ static void dissect_ulsch_or_dlsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree
proto_tree *bsr_tree;
proto_item *bsr_ti, *bsr_median_ti;
proto_item *buffer_size_ti;
- guint8 buffer_size[4];
+ guint32 buffer_size[4];
int hfindex[4];
value_string_ext *p_vs_ext;
guint32 *p_buffer_size_median;
@@ -6294,7 +6296,7 @@ static void dissect_ulsch_or_dlsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree
/* LCID Group 0 */
buffer_size_ti = proto_tree_add_item_ret_uint(bsr_tree, hfindex[0],
tvb, offset, 1,
- ENC_BIG_ENDIAN, (guint32*)&buffer_size[0]);
+ ENC_BIG_ENDIAN, &buffer_size[0]);
if (global_mac_lte_show_BSR_median) {
/* Add value that can be graphed */
@@ -6302,7 +6304,7 @@ static void dissect_ulsch_or_dlsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree
proto_item_set_generated(bsr_median_ti);
}
- if (buffer_size[0] >= global_mac_lte_bsr_warn_threshold) {
+ if ((gint)buffer_size[0] >= global_mac_lte_bsr_warn_threshold) {
expert_add_info_format(pinfo, buffer_size_ti, &ei_mac_lte_bsr_warn_threshold_exceeded,
"UE %u - BSR for LCG 0 exceeds threshold: %u (%s)",
p_mac_lte_info->ueid,
@@ -6313,7 +6315,7 @@ static void dissect_ulsch_or_dlsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree
/* LCID Group 1 */
buffer_size_ti = proto_tree_add_item_ret_uint(bsr_tree, hfindex[1],
tvb, offset, 2,
- ENC_BIG_ENDIAN, (guint32*)&buffer_size[1]);
+ ENC_BIG_ENDIAN, &buffer_size[1]);
if (global_mac_lte_show_BSR_median) {
/* Add value that can be graphed */
@@ -6322,7 +6324,7 @@ static void dissect_ulsch_or_dlsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree
}
offset++;
- if (buffer_size[1] >= global_mac_lte_bsr_warn_threshold) {
+ if ((gint)buffer_size[1] >= global_mac_lte_bsr_warn_threshold) {
expert_add_info_format(pinfo, buffer_size_ti, &ei_mac_lte_bsr_warn_threshold_exceeded,
"UE %u - BSR for LCG 1 exceeds threshold: %u (%s)",
p_mac_lte_info->ueid,
@@ -6333,7 +6335,7 @@ static void dissect_ulsch_or_dlsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree
/* LCID Group 2 */
buffer_size_ti = proto_tree_add_item_ret_uint(bsr_tree, hfindex[2],
tvb, offset, 2,
- ENC_BIG_ENDIAN, (guint32*)&buffer_size[2]);
+ ENC_BIG_ENDIAN, &buffer_size[2]);
if (global_mac_lte_show_BSR_median) {
/* Add value that can be graphed */
@@ -6342,7 +6344,7 @@ static void dissect_ulsch_or_dlsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree
}
offset++;
- if (buffer_size[2] >= global_mac_lte_bsr_warn_threshold) {
+ if ((gint)buffer_size[2] >= global_mac_lte_bsr_warn_threshold) {
expert_add_info_format(pinfo, buffer_size_ti, &ei_mac_lte_bsr_warn_threshold_exceeded,
"UE %u - BSR for LCG 2 exceeds threshold: %u (%s)",
p_mac_lte_info->ueid,
@@ -6353,7 +6355,7 @@ static void dissect_ulsch_or_dlsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree
/* LCID Group 3 */
buffer_size_ti = proto_tree_add_item_ret_uint(bsr_tree, hfindex[3],
tvb, offset, 1,
- ENC_BIG_ENDIAN, (guint32*)&buffer_size[3]);
+ ENC_BIG_ENDIAN, &buffer_size[3]);
if (global_mac_lte_show_BSR_median) {
/* Add value that can be graphed */
@@ -6362,7 +6364,7 @@ static void dissect_ulsch_or_dlsch(tvbuff_t *tvb, packet_info *pinfo, proto_tree
}
offset++;
- if (buffer_size[3] >= global_mac_lte_bsr_warn_threshold) {
+ if ((gint)buffer_size[3] >= global_mac_lte_bsr_warn_threshold) {
expert_add_info_format(pinfo, buffer_size_ti, &ei_mac_lte_bsr_warn_threshold_exceeded,
"UE %u - BSR for LCG 3 exceeds threshold: %u (%s)",
p_mac_lte_info->ueid,
diff --git a/epan/dissectors/packet-mbim.c b/epan/dissectors/packet-mbim.c
index 1b594968..0cf68657 100644
--- a/epan/dissectors/packet-mbim.c
+++ b/epan/dissectors/packet-mbim.c
@@ -3373,6 +3373,7 @@ mbim_dissect_nssai(tvbuff_t* tvb, proto_tree* tree, gint offset, gint nssai_buff
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
mbim_dissect_precfg_dflt_cfg_nssai(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, gint offset, gint nssai_buffer_length)
{
proto_tree* subtree;
@@ -3418,6 +3419,7 @@ mbim_dissect_rej_nssai(tvbuff_t* tvb, proto_tree* tree, gint offset, gint rej_ns
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
mbim_dissect_ladn(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, gint offset, gint rej_nssai_buffer_length)
{
proto_tree* subtree, * ladn_tree;
@@ -3598,6 +3600,7 @@ mbim_dissect_ursp_rules(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, gin
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
mbim_dissect_tlv_ie(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *offset)
{
guint tlv_data_offset;
@@ -3615,6 +3618,7 @@ mbim_dissect_tlv_ie(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *o
*offset += 4;
tlv_data_offset = *offset;
if (data_length) {
+ increment_dissection_depth(pinfo);
// New TLV types will be added here
switch (tlv_type) {
case TLV_TYPE_SINGLE_NSSAI:
@@ -3665,6 +3669,7 @@ mbim_dissect_tlv_ie(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint *o
proto_tree_add_item(tree, hf_mbim_tlv_ie_unnamed_data, tvb, *offset, data_length, ENC_NA);
break;
}
+ decrement_dissection_depth(pinfo);
*offset = tlv_data_offset + data_length;
}
if (padding_length) {
diff --git a/epan/dissectors/packet-mms.c b/epan/dissectors/packet-mms.c
index cacfdbaf..81e7aaf3 100644
--- a/epan/dissectors/packet-mms.c
+++ b/epan/dissectors/packet-mms.c
@@ -1039,7 +1039,6 @@ static int dissect_mms_AlternateAccess(bool implicit_tag _U_, tvbuff_t *tvb _U_,
static int dissect_mms_Data(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
-#define MAX_RECURSION_DEPTH 100 // Arbitrarily chosen.
static int
@@ -1558,16 +1557,15 @@ static const ber_choice_t TypeSpecification_choice[] = {
static int
dissect_mms_TypeSpecification(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 3;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // TypeSpecification → TypeSpecification/array → TypeSpecification
+ actx->pinfo->dissection_depth += 2;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_choice(actx, tree, tvb, offset,
TypeSpecification_choice, hf_index, ett_mms_TypeSpecification,
NULL);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 2;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
@@ -1749,15 +1747,14 @@ static const ber_sequence_t AlternateAccess_sequence_of[1] = {
static int
dissect_mms_AlternateAccess(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 5;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // AlternateAccess → AlternateAccess/_item → AlternateAccessSelection → AlternateAccessSelection/selectAlternateAccess → AlternateAccess
+ actx->pinfo->dissection_depth += 4;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
AlternateAccess_sequence_of, hf_index, ett_mms_AlternateAccess);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 4;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
@@ -1811,16 +1808,15 @@ static const ber_choice_t VariableSpecification_choice[] = {
static int
dissect_mms_VariableSpecification(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 4;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // VariableSpecification → ScatteredAccessDescription → ScatteredAccessDescription/_item → VariableSpecification
+ actx->pinfo->dissection_depth += 3;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_choice(actx, tree, tvb, offset,
VariableSpecification_choice, hf_index, ett_mms_VariableSpecification,
NULL);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 3;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
@@ -2097,16 +2093,15 @@ static const ber_choice_t Data_choice[] = {
static int
dissect_mms_Data(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 3;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // Data → Data/array → Data
+ actx->pinfo->dissection_depth += 2;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_choice(actx, tree, tvb, offset,
Data_choice, hf_index, ett_mms_Data,
NULL);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 2;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
diff --git a/epan/dissectors/packet-mongo.c b/epan/dissectors/packet-mongo.c
index 64e6747b..db23a063 100644
--- a/epan/dissectors/packet-mongo.c
+++ b/epan/dissectors/packet-mongo.c
@@ -319,6 +319,7 @@ dissect_fullcollectionname(tvbuff_t *tvb, guint offset, proto_tree *tree)
#define BSON_MAX_NESTING 100
#define BSON_MAX_DOC_SIZE (16 * 1000 * 1000)
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_bson_document(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int hf_mongo_doc)
{
gint32 document_length;
@@ -702,6 +703,7 @@ dissect_mongo_op_commandreply(tvbuff_t *tvb, packet_info *pinfo, guint offset, p
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_mongo_op_compressed(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, guint *effective_opcode)
{
guint opcode = 0;
@@ -896,10 +898,15 @@ dissect_mongo_op_msg(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_opcode_types(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *mongo_tree, guint opcode, guint *effective_opcode)
{
*effective_opcode = opcode;
+ unsigned recursion_depth = p_get_proto_depth(pinfo, proto_mongo);
+ DISSECTOR_ASSERT(recursion_depth <= BSON_MAX_NESTING);
+ p_set_proto_depth(pinfo, proto_mongo, recursion_depth + 1);
+
switch(opcode){
case OP_REPLY:
offset = dissect_mongo_reply(tvb, pinfo, offset, mongo_tree);
@@ -942,6 +949,8 @@ dissect_opcode_types(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree
break;
}
+ p_set_proto_depth(pinfo, proto_mongo, recursion_depth);
+
return offset;
}
diff --git a/epan/dissectors/packet-mpeg-pes.c b/epan/dissectors/packet-mpeg-pes.c
index 5db34f63..0ab1dea2 100644
--- a/epan/dissectors/packet-mpeg-pes.c
+++ b/epan/dissectors/packet-mpeg-pes.c
@@ -819,6 +819,7 @@ static int
dissect_mpeg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data);
static gboolean
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
int prefix;
@@ -854,6 +855,7 @@ dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
offset = dissect_mpeg_pes_PES(tvb, offset, &asn1_ctx,
tree, proto_mpeg_pes);
+ increment_dissection_depth(pinfo);
if (stream == STREAM_PICTURE) {
int frame_type;
@@ -1018,6 +1020,7 @@ dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
proto_tree_add_item(tree, hf_mpeg_pes_data, tvb,
offset / 8, -1, ENC_NA);
}
+ decrement_dissection_depth(pinfo);
return TRUE;
}
diff --git a/epan/dissectors/packet-mpls-echo.c b/epan/dissectors/packet-mpls-echo.c
index 6178c742..4e7a847b 100644
--- a/epan/dissectors/packet-mpls-echo.c
+++ b/epan/dissectors/packet-mpls-echo.c
@@ -1572,21 +1572,25 @@ dissect_mpls_echo_tlv(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tre
* Dissector for Errored TLVs
*/
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_mpls_echo_tlv_errored(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem)
{
int errored_tlv_length;
+ increment_dissection_depth(pinfo);
while (rem >= 4) {
errored_tlv_length = dissect_mpls_echo_tlv(tvb, pinfo, offset, tree, rem, TRUE);
rem -= errored_tlv_length;
offset += errored_tlv_length;
}
+ increment_dissection_depth(pinfo);
}
/*
* Dissector for MPLS Echo TLVs and return bytes consumed
*/
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_mpls_echo_tlv(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tree *tree, int rem, gboolean in_errored)
{
proto_tree *ti = NULL, *mpls_echo_tlv_tree = NULL;
diff --git a/epan/dissectors/packet-mq-pcf.c b/epan/dissectors/packet-mq-pcf.c
index b9b4b979..8e15e3ec 100644
--- a/epan/dissectors/packet-mq-pcf.c
+++ b/epan/dissectors/packet-mq-pcf.c
@@ -149,6 +149,8 @@ static void dissect_mqpcf_parm_int(tvbuff_t *tvb, proto_tree *tree, guint offset
}
}
}
+
+// NOLINTNEXTLINE(misc-no-recursion)
int dissect_mqpcf_parm_grp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* mq_tree,
guint offset, guint bLittleEndian, gboolean bParse)
{
@@ -169,6 +171,7 @@ int dissect_mqpcf_parm_grp(tvbuff_t* tvb, packet_info* pinfo, proto_tree* mq_tre
return offset;
}
+// NOLINTNEXTLINE(misc-no-recursion)
guint32 dissect_mqpcf_parm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *mq_tree,
guint offset, guint32 uCount, guint bLittleEndian, gboolean bParse)
{
@@ -252,6 +255,7 @@ guint32 dissect_mqpcf_parm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *mq_tre
uTyp, val_to_str_ext_const(uTyp, GET_VALS_EXTP(PrmTyp2), " Unkn") + 6,
uPrm, uPrm);
+ increment_dissection_depth(pinfo);
switch (uTyp)
{
case MQ_MQCFT_NONE:
@@ -571,6 +575,7 @@ guint32 dissect_mqpcf_parm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *mq_tre
}
break;
}
+ decrement_dissection_depth(pinfo);
offset = tOfs + uLen;
}
if (u != uCount)
diff --git a/epan/dissectors/packet-mqtt-sn.c b/epan/dissectors/packet-mqtt-sn.c
index b9623a0a..f086a3ec 100644
--- a/epan/dissectors/packet-mqtt-sn.c
+++ b/epan/dissectors/packet-mqtt-sn.c
@@ -184,6 +184,7 @@ static gint ett_mqttsn_msg = -1;
static gint ett_mqttsn_flags = -1;
/* Dissect a single MQTT-SN packet. */
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_mqttsn_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
/* Various variables. */
@@ -477,7 +478,9 @@ static void dissect_mqttsn_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree
/* Dissect encapsulated message (if present). */
if (tvb_reported_length_remaining(tvb, offset) > 0)
{
+ increment_dissection_depth(pinfo);
dissect_mqttsn_packet(tvb, pinfo, mqttsn_msg_tree, offset);
+ decrement_dissection_depth(pinfo);
}
/* Default Case */
diff --git a/epan/dissectors/packet-msdp.c b/epan/dissectors/packet-msdp.c
index ef952782..12532eb8 100644
--- a/epan/dissectors/packet-msdp.c
+++ b/epan/dissectors/packet-msdp.c
@@ -169,6 +169,7 @@ dissect_msdp_notification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_msdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
@@ -189,6 +190,7 @@ dissect_msdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
msdp_tree = proto_item_add_subtree(ti, ett_msdp);
offset = 0;
+ increment_dissection_depth(pinfo);
while (tvb_reported_length_remaining(tvb, offset) != 0) {
proto_tree_add_item_ret_uint(msdp_tree, hf_msdp_type, tvb, offset, 1, ENC_BIG_ENDIAN, &type);
length_item = proto_tree_add_item_ret_uint(msdp_tree, hf_msdp_length, tvb, offset + 1, 2, ENC_BIG_ENDIAN, &length);
@@ -269,6 +271,7 @@ dissect_msdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
break;
}
}
+ decrement_dissection_depth(pinfo);
return tvb_captured_length(tvb);
}
@@ -378,6 +381,7 @@ static void add_notification_data_ipv4addr(tvbuff_t *tvb, proto_tree *tree, int
return;
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_msdp_notification(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, guint16 tlv_len, proto_item *length_item)
{
guint8 error, error_sub;
diff --git a/epan/dissectors/packet-msgpack.c b/epan/dissectors/packet-msgpack.c
index fa7b819a..1dac8b38 100644
--- a/epan/dissectors/packet-msgpack.c
+++ b/epan/dissectors/packet-msgpack.c
@@ -157,6 +157,7 @@ static void dissect_msgpack_integer(tvbuff_t* tvb, packet_info *pinfo, proto_tre
}
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_msgpack_map(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, guint8 type, void* data, int* offset, char** value)
{
proto_tree* subtree;
@@ -178,6 +179,7 @@ static void dissect_msgpack_map(tvbuff_t* tvb, packet_info* pinfo, proto_tree* t
dissect_msgpack_object(tvb, pinfo, map_subtree, "Key", offset, value);
if (value)
proto_item_append_text(map_subtree, " %s:", *value);
+ // We recurse here, but we'll run out of packet before we run out of stack.
dissect_msgpack_object(tvb, pinfo, map_subtree, "Value", offset, value);
if (value)
proto_item_append_text(map_subtree, " %s", *value);
@@ -187,6 +189,7 @@ static void dissect_msgpack_map(tvbuff_t* tvb, packet_info* pinfo, proto_tree* t
*value = label;
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_msgpack_array(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, guint8 type, void* data, int* offset, char** value)
{
proto_tree* subtree;
@@ -203,6 +206,7 @@ static void dissect_msgpack_array(tvbuff_t* tvb, packet_info* pinfo, proto_tree*
subtree = proto_item_add_subtree(ti, ett_msgpack_array);
*offset += 1;
for (i = 0; i < len; i++) {
+ // We recurse here, but we'll run out of packet before we run out of stack.
dissect_msgpack_object(tvb, pinfo, subtree, data, offset, value);
}
@@ -312,6 +316,7 @@ static void dissect_msgpack_ext(tvbuff_t* tvb, proto_tree* tree, int type, void*
proto_item_set_len(ext_tree, *offset - offset_start);
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_msgpack_object(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, void* data, int* offset, char** value)
{
guint8 type;
@@ -356,12 +361,14 @@ static void dissect_msgpack_object(tvbuff_t* tvb, packet_info* pinfo, proto_tree
// Array
if (type >> 4 == 0x9) {
+ // We recurse here, but we'll run out of packet before we run out of stack.
dissect_msgpack_array(tvb, pinfo, tree, type, data, offset, value);
return;
}
// Map
if (type >> 4 == 0x8) {
+ // We recurse here, but we'll run out of packet before we run out of stack.
dissect_msgpack_map(tvb, pinfo, tree, type, data, offset, value);
return;
}
@@ -464,6 +471,7 @@ void proto_register_msgpack(void)
void proto_reg_handoff_msgpack(void)
{
+ // If this is ever streamed (transported over TCP) we need to add recursion checks
dissector_add_for_decode_as("udp.port", msgpack_handle);
}
diff --git a/epan/dissectors/packet-mswsp.c b/epan/dissectors/packet-mswsp.c
index 5f676c69..d706c803 100644
--- a/epan/dissectors/packet-mswsp.c
+++ b/epan/dissectors/packet-mswsp.c
@@ -3531,6 +3531,7 @@ static int parse_CPropertyRestriction(tvbuff_t *tvb, packet_info *pinfo, int off
return offset;
}
+// NOLINTNEXTLINE(misc-no-recursion)
static int parse_CCoercionRestriction(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *parent_tree, proto_tree *pad_tree, struct CCoercionRestriction *v, const char *fmt, ...)
{
proto_tree *tree;
@@ -3746,6 +3747,7 @@ static int parse_rType(tvbuff_t *tvb, int offset, proto_tree *tree, enum rType *
return offset + 4;
}
+// NOLINTNEXTLINE(misc-no-recursion)
static int parse_CRestriction(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *parent_tree, proto_tree *pad_tree, struct CRestriction *v, const char *fmt, ...)
{
proto_tree *tree;
@@ -3767,6 +3769,7 @@ static int parse_CRestriction(tvbuff_t *tvb, packet_info *pinfo, int offset, pro
proto_tree_add_uint(tree, hf_mswsp_crestrict_weight, tvb, offset, 4, v->Weight);
offset += 4;
+ increment_dissection_depth(pinfo);
switch(v->ulType) {
case RTNone:
break;
@@ -3819,6 +3822,7 @@ static int parse_CRestriction(tvbuff_t *tvb, packet_info *pinfo, int offset, pro
default:
proto_item_append_text(item, " Not supported!");
}
+ decrement_dissection_depth(pinfo);
proto_item_set_end(item, tvb, offset);
return offset;
@@ -3861,6 +3865,7 @@ static int parse_CRestrictionArray(tvbuff_t *tvb, packet_info *pinfo, int offset
return offset;
}
+// NOLINTNEXTLINE(misc-no-recursion)
static int parse_CNodeRestriction(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *parent_tree, proto_tree *pad_tree, struct CNodeRestriction *v, const char *fmt, ...)
{
proto_tree *tree;
@@ -7980,8 +7985,7 @@ proto_register_mswsp(void)
};
int i;
- proto_mswsp = proto_register_protocol("Windows Search Protocol",
- "MS-WSP", "mswsp");
+ proto_mswsp = proto_register_protocol("Windows Search Protocol", "MS-WSP", "mswsp");
proto_register_field_array(proto_mswsp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
diff --git a/epan/dissectors/packet-nas_5gs.c b/epan/dissectors/packet-nas_5gs.c
index ac58b247..915ae1c0 100644
--- a/epan/dissectors/packet-nas_5gs.c
+++ b/epan/dissectors/packet-nas_5gs.c
@@ -2897,12 +2897,14 @@ static const value_string nas_5gs_mm_pld_cont_opt_ie_type_vals[] = {
* 9.11.3.39 Payload container
*/
static guint16
+// NOLINTNEXTLINE(misc-no-recursion)
de_nas_5gs_mm_pld_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo,
guint32 offset, guint len,
gchar *add_string _U_, int string_len _U_)
{
struct nas5gs_private_data *nas5gs_data = nas5gs_get_private_data(pinfo);
+ increment_dissection_depth(pinfo);
switch (nas5gs_data->payload_container_type) {
case 1: /* N1 SM information */
dissect_nas_5gs_common(tvb_new_subset_length(tvb, offset, len), pinfo, tree, 0, NULL);
@@ -3032,6 +3034,7 @@ de_nas_5gs_mm_pld_cont(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo,
proto_tree_add_item(tree, hf_nas_5gs_mm_pld_cont, tvb, offset, len, ENC_NA);
break;
}
+ decrement_dissection_depth(pinfo);
return len;
}
diff --git a/epan/dissectors/packet-nbt.c b/epan/dissectors/packet-nbt.c
index c409bca5..abb6b252 100644
--- a/epan/dissectors/packet-nbt.c
+++ b/epan/dissectors/packet-nbt.c
@@ -1468,16 +1468,39 @@ dissect_nbss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
* (If it is reassembled data, it shouldn't be a continuation,
* as reassembly should've gathered the continuations together
* into a message.)
+ * XXX: Unless it was reassembled because we didn't have enough
+ * data for a NBSS header, it had a first byte that looked like a
+ * message type, but it turned out not to be a message but continuation
+ * data after all. Perhaps we should check even reassembled data,
+ * at least if it's the first message in the conversation.
*/
if (!tcpinfo->is_reassembled) {
if (max_data < 4) {
/*
- * Not enough data for an NBSS header; assume
- * it's a continuation of a message.
- *
- * XXX - if there's not enough data, we should
- * attempt to reassemble the data, if the first byte
- * is a valid message type.
+ * Not enough data for an NBSS header. It could be a message
+ * split into a very small payload, or a continuation of a message.
+ */
+ if (try_val_to_str(msg_type, message_types)) {
+ /*
+ * The first byte looks like a valid message type.
+ * Can we do reassembly?
+ */
+ if (nbss_desegment && pinfo->can_desegment) {
+ /*
+ * Yes. Tell the TCP dissector where the data for this message
+ * starts in the data it handed us and that we need "some more
+ * data." Don't tell it exactly how many bytes we need because
+ * if/when we ask for even more (after the header) that will
+ * break reassembly.
+ */
+ pinfo->desegment_offset = offset;
+ pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
+ return tvb_captured_length(tvb);
+ }
+ }
+ /*
+ * Either we can't do reassembly, or this doesn't look
+ * like a valid message type. Mark it as continuation.
*/
return dissect_continuation_packet(tvb, pinfo, tree);
}
diff --git a/epan/dissectors/packet-netflow.c b/epan/dissectors/packet-netflow.c
index 4226b815..5c6ffaab 100644
--- a/epan/dissectors/packet-netflow.c
+++ b/epan/dissectors/packet-netflow.c
@@ -5123,6 +5123,7 @@ enum duration_type_e {
/* SubTemplateList reference https://tools.ietf.org/html/rfc6313#section-4.5.2 */
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_v10_pdu_subtemplate_list(tvbuff_t* tvb, packet_info* pinfo, proto_item* pduitem, int offset,
guint16 length, hdrinfo_t* hdrinfo_p)
{
@@ -5156,6 +5157,7 @@ dissect_v10_pdu_subtemplate_list(tvbuff_t* tvb, packet_info* pinfo, proto_item*
}
proto_item_set_generated(ti);
+ increment_dissection_depth(pinfo);
while (offset < end_offset) {
sub_tree = proto_tree_add_subtree_format(pdutree, tvb, offset, subtmplt_p->length,
ett_subtemplate_list, NULL, "List Item %d", count++);
@@ -5168,6 +5170,7 @@ dissect_v10_pdu_subtemplate_list(tvbuff_t* tvb, packet_info* pinfo, proto_item*
}
offset += consumed;
}
+ decrement_dissection_depth(pinfo);
if (offset != end_offset) {
int data_bytes = offset - start_offset;
proto_tree_add_expert_format(pdutree, NULL, &ei_cflow_subtemplate_bad_length,
@@ -5184,6 +5187,7 @@ dissect_v10_pdu_subtemplate_list(tvbuff_t* tvb, packet_info* pinfo, proto_item*
}
static guint
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_v9_v10_pdu_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *pdutree, int offset,
v9_v10_tmplt_t *tmplt_p, hdrinfo_t *hdrinfo_p, v9_v10_tmplt_fields_type_t fields_type)
{
@@ -5289,6 +5293,9 @@ dissect_v9_v10_pdu_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *pdutree,
string_len_long = length = tvb_get_ntohs(tvb, offset+1);
}
offset += vstr_len;
+ if (length == 0) {
+ continue;
+ }
gen_str_offset = offset;
}
diff --git a/epan/dissectors/packet-netlink.c b/epan/dissectors/packet-netlink.c
index b437ed34..200d4718 100644
--- a/epan/dissectors/packet-netlink.c
+++ b/epan/dissectors/packet-netlink.c
@@ -14,6 +14,8 @@
#include <epan/packet.h>
#include <epan/arptypes.h>
#include <epan/exceptions.h>
+#include <epan/prefs.h>
+
#include <wiretap/wtap.h>
#include <wsutil/ws_roundup.h>
@@ -152,6 +154,7 @@ static int * const netlink_header_standard_flags[] = {
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_netlink_attributes_common(tvbuff_t *tvb, int hf_type, int ett_tree, int ett_attrib, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int offset, int length, netlink_attributes_cb_t cb)
{
int encoding;
@@ -261,6 +264,9 @@ dissect_netlink_attributes_common(tvbuff_t *tvb, int hf_type, int ett_tree, int
offset += 2;
proto_item_append_text(ti, " %u", rta_type);
+ // In theory we should use increment_dissection_depth here, but that
+ // requires adding pinfo all over packet-netlink*.[ch] and we're limited
+ // to 262144 bytes (WTAP_MAX_PACKET_SIZE_STANDARD).
dissect_netlink_attributes(tvb, hf_type, ett_attrib, data, nl_data, attr_tree, offset, rta_len - 4, cb);
}
@@ -276,6 +282,7 @@ dissect_netlink_attributes_common(tvbuff_t *tvb, int hf_type, int ett_tree, int
}
int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_netlink_attributes(tvbuff_t *tvb, int hf_type, int ett, void *data, struct packet_netlink_data *nl_data, proto_tree *tree, int offset, int length, netlink_attributes_cb_t cb)
{
return dissect_netlink_attributes_common(tvb, hf_type, ett, -1, data, nl_data, tree, offset, length, cb);
diff --git a/epan/dissectors/packet-nhrp.c b/epan/dissectors/packet-nhrp.c
index 44edaebb..33c32b0c 100644
--- a/epan/dissectors/packet-nhrp.c
+++ b/epan/dissectors/packet-nhrp.c
@@ -562,6 +562,7 @@ static void dissect_cie_list(tvbuff_t *tvb,
}
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void dissect_nhrp_mand(tvbuff_t *tvb,
packet_info *pinfo,
proto_tree *tree,
@@ -757,6 +758,7 @@ static void dissect_nhrp_mand(tvbuff_t *tvb,
save_in_error_pkt = pinfo->flags.in_error_pkt;
pinfo->flags.in_error_pkt = TRUE;
sub_tvb = tvb_new_subset_remaining(tvb, offset);
+ // We recurse here, but we'll run out of packet before we run out of stack.
_dissect_nhrp(sub_tvb, pinfo, ind_tree, TRUE, FALSE);
pinfo->flags.in_error_pkt = save_in_error_pkt;
break;
@@ -994,6 +996,7 @@ static int dissect_nhrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
return tvb_captured_length(tvb);
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void _dissect_nhrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
gboolean nested, gboolean codeinfo)
{
@@ -1034,6 +1037,7 @@ static void _dissect_nhrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
if (mandLen) {
tvbuff_t *mand_tvb = tvb_new_subset_length(tvb, offset, mandLen);
+ // We recurse here, but we'll run out of packet before we run out of stack.
dissect_nhrp_mand(mand_tvb, pinfo, nhrp_tree, oui_info, &hdr, &srcLen,
codeinfo);
offset += mandLen;
diff --git a/epan/dissectors/packet-ntlmssp.c b/epan/dissectors/packet-ntlmssp.c
index 85ec0e9a..a538c204 100644
--- a/epan/dissectors/packet-ntlmssp.c
+++ b/epan/dissectors/packet-ntlmssp.c
@@ -764,6 +764,7 @@ create_ntlmssp_v1_key(const guint8 *serverchallenge, const guint8 *clientchallen
static const unsigned char lmhash_key[] =
{0x4b, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25}; // "KGS!@#$%"
+ memset(sessionkey, 0, NTLMSSP_KEY_LEN);
/* Create a NT hash of the input password, even if empty */
// NTOWFv1 as defined in https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-nlmp/464551a8-9fc4-428e-b3d3-bc5bfb2e73a5
password_len = strlen(password);
@@ -857,7 +858,6 @@ create_ntlmssp_v1_key(const guint8 *serverchallenge, const guint8 *clientchallen
}
get_keyexchange_key(keyexchangekey, sessionbasekey, lm_challenge_response, flags);
- memset(sessionkey, 0, NTLMSSP_KEY_LEN);
/*printnbyte(nt_challenge_response, 24, "NT challenge response", "\n");
printnbyte(lm_challenge_response, 24, "LM challenge response", "\n");*/
/* now decrypt session key if needed and setup sessionkey for decrypting further communications */
diff --git a/epan/dissectors/packet-openflow_v4.c b/epan/dissectors/packet-openflow_v4.c
index a4c47044..b4901d63 100644
--- a/epan/dissectors/packet-openflow_v4.c
+++ b/epan/dissectors/packet-openflow_v4.c
@@ -1494,6 +1494,7 @@ static const value_string openflow_v4_error_table_features_failed_code_values[]
};
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_openflow_error_v4(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, guint16 length)
{
proto_tree *data_tree;
@@ -4342,6 +4343,7 @@ dissect_openflow_metermod_v4(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_openflow_message_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *openflow_tree, int offset)
{
diff --git a/epan/dissectors/packet-openflow_v5.c b/epan/dissectors/packet-openflow_v5.c
index ffe2f56b..d49de46f 100644
--- a/epan/dissectors/packet-openflow_v5.c
+++ b/epan/dissectors/packet-openflow_v5.c
@@ -1752,6 +1752,7 @@ static const value_string openflow_v5_error_bundle_failed_code_values[] = {
};
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_openflow_error_v5(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, guint16 length)
{
proto_tree *data_tree;
@@ -5746,6 +5747,7 @@ dissect_openflow_table_status_v5(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_openflow_requestforward_v5(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, guint16 length _U_)
{
proto_item *ti;
@@ -5879,6 +5881,7 @@ dissect_openflow_bundle_control_v5(tvbuff_t *tvb, packet_info *pinfo _U_, proto_
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_openflow_bundle_add_v5(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, guint16 length _U_)
{
proto_item *ti;
@@ -5917,6 +5920,7 @@ dissect_openflow_bundle_add_v5(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_openflow_message_v5(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
guint8 type;
diff --git a/epan/dissectors/packet-openflow_v6.c b/epan/dissectors/packet-openflow_v6.c
index 12e2be14..d6dbe272 100644
--- a/epan/dissectors/packet-openflow_v6.c
+++ b/epan/dissectors/packet-openflow_v6.c
@@ -1980,6 +1980,7 @@ static const value_string openflow_v6_error_bundle_failed_code_values[] = {
};
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_openflow_error_v6(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, guint16 length)
{
proto_tree *data_tree;
@@ -4509,6 +4510,7 @@ dissect_openflow_switch_description_v6(tvbuff_t *tvb, packet_info *pinfo _U_, pr
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_openflow_flow_desc_v6(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, guint16 length _U_)
{
proto_item *ti;
@@ -6351,6 +6353,7 @@ dissect_openflow_table_status_v6(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tr
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_openflow_requestforward_v6(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, guint16 length _U_)
{
proto_item *ti;
@@ -6490,6 +6493,7 @@ dissect_openflow_bundle_control_v6(tvbuff_t *tvb, packet_info *pinfo _U_, proto_
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_openflow_bundle_add_v6(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, guint16 length _U_)
{
proto_item *ti;
@@ -6528,6 +6532,7 @@ dissect_openflow_bundle_add_v6(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_openflow_message_v6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
guint8 type;
diff --git a/epan/dissectors/packet-opensafety.c b/epan/dissectors/packet-opensafety.c
index d56d3fda..695fa41b 100644
--- a/epan/dissectors/packet-opensafety.c
+++ b/epan/dissectors/packet-opensafety.c
@@ -1813,7 +1813,7 @@ check_scmudid_validity(opensafety_packet_info *packet, tvbuff_t *message_tvb)
/* Now confirm, that the xor operation was successful. The ID fields of both frames have to be the same */
b_ID = tvb_get_guint8(message_tvb, packet->frame.subframe2 + 1) ^ (guint8)(scmUDID->data[OSS_FRAME_POS_ID]);;
- if ( ( OSS_FRAME_ID_T(message_tvb, packet->frame.subframe1) ^ b_ID ) != 0 )
+ if ( ( OSS_FRAME_ID_T(message_tvb, packet->frame.subframe1) ^ (b_ID & 0xFC)) != 0 )
packet->scm_udid_valid = FALSE;
/* The IDs do not match, but the SCM UDID could still be ok. This happens, if this packet
diff --git a/epan/dissectors/packet-openwire.c b/epan/dissectors/packet-openwire.c
index a057d7d9..1beb68ce 100644
--- a/epan/dissectors/packet-openwire.c
+++ b/epan/dissectors/packet-openwire.c
@@ -657,6 +657,7 @@ static int
dissect_openwire_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int parentType);
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int field, int type, int parentType, gboolean nullable)
{
gint startOffset = offset;
@@ -717,7 +718,11 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o
inner_item = proto_tree_add_item(tree, particularize(field, hf_openwire_none), tvb, startOffset, -1, ENC_NA);
proto_item_append_text(inner_item, ": %s", val_to_str_ext(iCommand, &openwire_opcode_vals_ext, "Unknown (0x%02x)"));
object_tree = proto_item_add_subtree(inner_item, ett_openwire_type);
- return (1 + dissect_openwire_command(tvb, pinfo, object_tree, offset, parentType));
+ increment_dissection_depth(pinfo);
+ int command_offset = 1 + dissect_openwire_command(tvb, pinfo, object_tree, offset, parentType);
+ decrement_dissection_depth(pinfo);
+ return command_offset;
+
}
if ((type == OPENWIRE_TYPE_NESTED || type == OPENWIRE_TYPE_CACHED) && tvb_reported_length_remaining(tvb, offset) >= 1)
{
@@ -1071,6 +1076,7 @@ dissect_openwire_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_openwire_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int parentType)
{
gint startOffset = offset;
diff --git a/epan/dissectors/packet-opsi.c b/epan/dissectors/packet-opsi.c
index f2701437..c0aae3f0 100644
--- a/epan/dissectors/packet-opsi.c
+++ b/epan/dissectors/packet-opsi.c
@@ -484,17 +484,23 @@ get_opsi_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _
}
static int
-get_opsi_attribute_index(int min, int max, int attribute_type)
+// NOLINTNEXTLINE(misc-no-recursion)
+get_opsi_attribute_index(packet_info *pinfo, int min, int max, int attribute_type)
{
int middle, at;
middle = (min+max)/2;
at = opsi_attributes[middle].attribute_type;
if (at == attribute_type) return middle;
+ int attr_idx;
+ increment_dissection_depth(pinfo);
if (attribute_type > at) {
- return (middle == max) ? -1 : get_opsi_attribute_index(middle+1, max, attribute_type);
+ attr_idx = (middle == max) ? -1 : get_opsi_attribute_index(pinfo, middle+1, max, attribute_type);
+ } else {
+ attr_idx = (middle == min) ? -1 : get_opsi_attribute_index(pinfo, min, middle-1, attribute_type);
}
- return (middle == min) ? -1 : get_opsi_attribute_index(min, middle-1, attribute_type);
+ decrement_dissection_depth(pinfo);
+ return attr_idx;
}
@@ -512,7 +518,7 @@ dissect_attributes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *opsi_tree, int
attribute_length = tvb_get_ntohs(tvb, offset+2);
if (attribute_length > length) break;
/* We perform a standard log(n) lookup */
- i = get_opsi_attribute_index(0, OPSI_ATTRIBUTES_COUNT-1, attribute_type);
+ i = get_opsi_attribute_index(pinfo, 0, OPSI_ATTRIBUTES_COUNT-1, attribute_type);
if (i == -1) {
proto_tree_add_expert_format(opsi_tree, pinfo, &ei_opsi_unknown_attribute, tvb, offset, attribute_length,
"Unknown attribute (%d)", attribute_type);
@@ -845,8 +851,7 @@ proto_register_opsi(void)
expert_module_t* expert_opsi;
/* Register the protocol name and description */
- proto_opsi = proto_register_protocol("Open Policy Service Interface",
- "OPSI", "opsi");
+ proto_opsi = proto_register_protocol("Open Policy Service Interface", "OPSI", "opsi");
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_opsi, hf, array_length(hf));
diff --git a/epan/dissectors/packet-osc.c b/epan/dissectors/packet-osc.c
index 2abef37c..fe09053d 100644
--- a/epan/dissectors/packet-osc.c
+++ b/epan/dissectors/packet-osc.c
@@ -725,7 +725,8 @@ dissect_osc_message(tvbuff_t *tvb, proto_item *ti, proto_tree *osc_tree, gint of
/* Dissect OSC bundle */
static int
-dissect_osc_bundle(tvbuff_t *tvb, proto_item *ti, proto_tree *osc_tree, gint offset, gint len)
+// NOLINTNEXTLINE(misc-no-recursion)
+dissect_osc_bundle(tvbuff_t *tvb, packet_info *pinfo, proto_item *ti, proto_tree *osc_tree, gint offset, gint len)
{
proto_tree *bundle_tree;
gint end = offset + len;
@@ -768,10 +769,11 @@ dissect_osc_bundle(tvbuff_t *tvb, proto_item *ti, proto_tree *osc_tree, gint off
continue;
/* peek first bundle element char */
+ increment_dissection_depth(pinfo);
switch(tvb_get_guint8(tvb, offset))
{
case '#': /* this is a bundle */
- if(dissect_osc_bundle(tvb, ti, bundle_tree, offset, size))
+ if(dissect_osc_bundle(tvb, pinfo, ti, bundle_tree, offset, size))
return -1;
else
break;
@@ -783,6 +785,7 @@ dissect_osc_bundle(tvbuff_t *tvb, proto_item *ti, proto_tree *osc_tree, gint off
default:
return -1; /* neither message nor bundle */
}
+ decrement_dissection_depth(pinfo);
/* check for integer overflow */
if(size > G_MAXINT - offset)
@@ -817,7 +820,7 @@ dissect_osc_pdu_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
switch(tvb_get_guint8(tvb, offset))
{
case '#': /* this is a bundle */
- if(dissect_osc_bundle(tvb, ti, osc_tree, offset, len))
+ if(dissect_osc_bundle(tvb, pinfo, ti, osc_tree, offset, len))
return;
else
break;
diff --git a/epan/dissectors/packet-p22.c b/epan/dissectors/packet-p22.c
index ea2004ba..8486a0c7 100644
--- a/epan/dissectors/packet-p22.c
+++ b/epan/dissectors/packet-p22.c
@@ -839,7 +839,6 @@ static int dissect_p22_BodyPartTokens(bool implicit_tag _U_, tvbuff_t *tvb _U_,
static int dissect_p22_ForwardedContentToken(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
-#define MAX_RECURSION_DEPTH 100 // Arbitrarily chosen.
static int
@@ -1802,11 +1801,9 @@ static const ber_sequence_t IPM_sequence[] = {
int
dissect_p22_IPM(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 7;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // IPM → Body → BodyPart → BodyPart/basic → MessageBodyPart → MessageData → IPM
+ actx->pinfo->dissection_depth += 6;
+ increment_dissection_depth(actx->pinfo);
col_append_str(actx->pinfo->cinfo, COL_INFO, " Message");
@@ -1816,7 +1813,8 @@ dissect_p22_IPM(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_c
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 6;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
@@ -3519,15 +3517,14 @@ static const ber_sequence_t IPMSynopsis_sequence_of[1] = {
static int
dissect_p22_IPMSynopsis(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 4;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // IPMSynopsis → BodyPartSynopsis → MessageBodyPartSynopsis → IPMSynopsis
+ actx->pinfo->dissection_depth += 3;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_sequence_of(implicit_tag, actx, tree, tvb, offset,
IPMSynopsis_sequence_of, hf_index, ett_p22_IPMSynopsis);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 3;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
@@ -3985,15 +3982,14 @@ static const ber_sequence_t BodyPartTokens_set_of[1] = {
static int
dissect_p22_BodyPartTokens(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 4;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // BodyPartTokens → BodyPartTokens/_item → BodyPartTokens/_item/body-part-choice → BodyPartTokens
+ actx->pinfo->dissection_depth += 3;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset,
BodyPartTokens_set_of, hf_index, ett_p22_BodyPartTokens);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 3;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
@@ -4041,15 +4037,14 @@ static const ber_sequence_t ForwardedContentToken_set_of[1] = {
static int
dissect_p22_ForwardedContentToken(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 4;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // ForwardedContentToken → ForwardedContentToken/_item → ForwardedContentToken/_item/body-part-choice → ForwardedContentToken
+ actx->pinfo->dissection_depth += 3;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_set_of(implicit_tag, actx, tree, tvb, offset,
ForwardedContentToken_set_of, hf_index, ett_p22_ForwardedContentToken);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 3;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
diff --git a/epan/dissectors/packet-p7.c b/epan/dissectors/packet-p7.c
index 6748d979..c791133d 100644
--- a/epan/dissectors/packet-p7.c
+++ b/epan/dissectors/packet-p7.c
@@ -644,7 +644,6 @@ static const value_string p7_err_code_string_vals[] = {
static int dissect_p7_Filter(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
-#define MAX_RECURSION_DEPTH 100 // Arbitrarily chosen.
static int
@@ -1559,16 +1558,15 @@ static const ber_choice_t Filter_choice[] = {
static int
dissect_p7_Filter(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 3;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // Filter → Filter/and → Filter
+ actx->pinfo->dissection_depth += 2;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_choice(actx, tree, tvb, offset,
Filter_choice, hf_index, ett_p7_Filter,
NULL);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 2;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
diff --git a/epan/dissectors/packet-pana.c b/epan/dissectors/packet-pana.c
index dc64b682..03edebc7 100644
--- a/epan/dissectors/packet-pana.c
+++ b/epan/dissectors/packet-pana.c
@@ -276,6 +276,7 @@ pana_avp_get_type(guint16 avp_code, guint32 vendor_id)
* Function for AVP dissector.
*/
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_avps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *avp_tree)
{
@@ -367,6 +368,7 @@ dissect_avps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *avp_tree)
group_tvb = tvb_new_subset_length_caplen(tvb, offset,
MIN(avp_data_length, tvb_reported_length(tvb)-offset),
avp_data_length);
+ // We recurse here, but we'll run out of packet before we run out of stack.
dissect_avps(group_tvb, pinfo, avp_group_tree);
break;
}
@@ -427,6 +429,7 @@ dissect_avps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *avp_tree)
tvb, offset, avp_data_length,
ett_pana_avp, NULL, "AVP Value (PANA packet)");
encap_tvb = tvb_new_subset_length(tvb, offset, avp_data_length);
+ // We recurse here, but we'll run out of packet before we run out of stack.
dissect_pana_pdu(encap_tvb, pinfo, avp_encap_tree);
break;
}
@@ -445,6 +448,7 @@ dissect_avps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *avp_tree)
* Function for the PANA PDU dissector.
*/
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_pana_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
@@ -859,8 +863,7 @@ proto_register_pana(void)
};
/* Register the protocol name and description */
- proto_pana = proto_register_protocol("Protocol for carrying Authentication for Network Access",
- "PANA", "pana");
+ proto_pana = proto_register_protocol("Protocol for carrying Authentication for Network Access", "PANA", "pana");
/* Required function calls to register the header fields and subtrees used */
proto_register_field_array(proto_pana, hf, array_length(hf));
diff --git a/epan/dissectors/packet-parlay.c b/epan/dissectors/packet-parlay.c
index ecec46a3..7d07fdea 100644
--- a/epan/dissectors/packet-parlay.c
+++ b/epan/dissectors/packet-parlay.c
@@ -23,6 +23,7 @@
#include <string.h>
#include <epan/packet.h>
#include <epan/proto.h>
+#include <epan/proto_data.h>
#include "packet-giop.h"
#include <epan/expert.h>
@@ -2997,6 +2998,7 @@ static expert_field ei_parlay_unknown_giop_msg = EI_INIT;
static expert_field ei_parlay_unknown_exception = EI_INIT;
static expert_field ei_parlay_unknown_reply_status = EI_INIT;
+#define MAX_RECURSION_DEPTH 50 // Arbitrarily chosen.
static proto_tree *start_dissecting(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int *offset);
@@ -53623,6 +53625,7 @@ decode_org_csapi_cs_TpAppInformation_un(tvbuff_t *tvb _U_, packet_info *pinfo _U
}
/* Union = IDL:org/csapi/policy/TpPolicyType:1.0 */
+// NOLINTBEGIN(misc-no-recursion)
static void
decode_org_csapi_policy_TpPolicyType_un(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_tree *tree _U_, int *offset _U_, MessageHeader *header _U_, const gchar *operation _U_, gboolean stream_is_big_endian _U_)
{
@@ -53633,6 +53636,11 @@ decode_org_csapi_policy_TpPolicyType_un(tvbuff_t *tvb _U_, packet_info *pinfo _U
gint32 disc_s_TpPolicyType;
/* Operation specific Variable declarations End */
+ // Cycle: this -> decode_org_csapi_policy_TpPolicyType_TpPolicyListType_st -> this
+ unsigned recursion_depth = p_get_proto_depth(pinfo, proto_parlay);
+ DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
+ p_set_proto_depth(pinfo, proto_parlay, recursion_depth + 1);
+
/*
* IDL Union Start - IDL:org/csapi/policy/TpPolicyType:1.0
*/
@@ -53651,6 +53659,7 @@ decode_org_csapi_policy_TpPolicyType_un(tvbuff_t *tvb _U_, packet_info *pinfo _U
u_octet4 = get_CDR_enum(tvb,offset,stream_is_big_endian, boundary);
proto_tree_add_uint(tree, hf_org_csapi_policy_TpPolicyType_SimpleType, tvb, *offset-4, 4, u_octet4);
+ p_set_proto_depth(pinfo, proto_parlay, recursion_depth);
return; /* End Compare for this discriminant type */
}
@@ -53659,6 +53668,7 @@ decode_org_csapi_policy_TpPolicyType_un(tvbuff_t *tvb _U_, packet_info *pinfo _U
/* Begin struct "org_csapi_policy_TpPolicyType_TpPolicyRecordType" */
decode_org_csapi_policy_TpPolicyType_TpPolicyRecordType_st(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
/* End struct "org_csapi_policy_TpPolicyType_TpPolicyRecordType" */
+ p_set_proto_depth(pinfo, proto_parlay, recursion_depth);
return; /* End Compare for this discriminant type */
}
@@ -53667,6 +53677,7 @@ decode_org_csapi_policy_TpPolicyType_un(tvbuff_t *tvb _U_, packet_info *pinfo _U
/* Begin struct "org_csapi_policy_TpPolicyType_TpPolicyListType" */
decode_org_csapi_policy_TpPolicyType_TpPolicyListType_st(tvb, pinfo, tree, item, offset, header, operation, stream_is_big_endian);
/* End struct "org_csapi_policy_TpPolicyType_TpPolicyListType" */
+ p_set_proto_depth(pinfo, proto_parlay, recursion_depth);
return; /* End Compare for this discriminant type */
}
@@ -53674,6 +53685,7 @@ decode_org_csapi_policy_TpPolicyType_un(tvbuff_t *tvb _U_, packet_info *pinfo _U
giop_add_CDR_string(tree, tvb, offset, stream_is_big_endian, boundary, hf_org_csapi_policy_TpPolicyType_StructuredType);
+ p_set_proto_depth(pinfo, proto_parlay, recursion_depth);
return; /* End Compare for this discriminant type */
}
@@ -53681,10 +53693,13 @@ decode_org_csapi_policy_TpPolicyType_un(tvbuff_t *tvb _U_, packet_info *pinfo _U
giop_add_CDR_string(tree, tvb, offset, stream_is_big_endian, boundary, hf_org_csapi_policy_TpPolicyType_XMLString);
+ p_set_proto_depth(pinfo, proto_parlay, recursion_depth);
return; /* End Compare for this discriminant type */
}
+ p_set_proto_depth(pinfo, proto_parlay, recursion_depth);
}
+// NOLINTEND(misc-no-recursion)
/* Union = IDL:org/csapi/pam/TpPAMContextData:1.0 */
static void
diff --git a/epan/dissectors/packet-pim.c b/epan/dissectors/packet-pim.c
index 1277cbbd..7c9ac399 100644
--- a/epan/dissectors/packet-pim.c
+++ b/epan/dissectors/packet-pim.c
@@ -759,6 +759,7 @@ dissect_pimv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U
}
static gboolean
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_pim_addr(packet_info *pinfo, proto_tree* tree, tvbuff_t *tvb, int offset, enum pimv2_addrtype at,
const char* label, proto_item** ret_item, int hf_ip4, int hf_ip6, int *advance) {
guint8 af, et, flags, mask_len, ja_af;
@@ -1011,6 +1012,7 @@ dissect_pim_addr(packet_info *pinfo, proto_tree* tree, tvbuff_t *tvb, int offset
case PIM_JOIN_ATTRIBUTE_TYPE_RPF:
if ((ja_length == 6) || (ja_length == 18)) {
int advance_attr;
+ // We recurse here, but we'll run out of packet before we run out of stack.
if (!dissect_pim_addr(pinfo, ja_tree, tvb, ja_offset, pimv2_unicast, NULL, NULL,
hf_pim_unicast_addr_ipv4, hf_pim_unicast_addr_ipv6, &advance_attr))
break;
@@ -2292,8 +2294,7 @@ proto_register_pim(void)
expert_module_t* expert_pim;
module_t *pim_module;
- proto_pim = proto_register_protocol("Protocol Independent Multicast",
- "PIM", "pim");
+ proto_pim = proto_register_protocol("Protocol Independent Multicast", "PIM", "pim");
proto_register_field_array(proto_pim, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
expert_pim = expert_register_protocol(proto_pim);
diff --git a/epan/dissectors/packet-protobuf.c b/epan/dissectors/packet-protobuf.c
index ee7c5ab0..8597da4a 100644
--- a/epan/dissectors/packet-protobuf.c
+++ b/epan/dissectors/packet-protobuf.c
@@ -387,6 +387,7 @@ dissect_protobuf_message(tvbuff_t *tvb, guint offset, guint length, packet_info
* Return consumed bytes
*/
static guint
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_packed_repeated_field_values(tvbuff_t *tvb, guint start, guint length, packet_info *pinfo,
proto_item *ti_field, int field_type, const gchar* prepend_text, const PbwFieldDescriptor* field_desc,
json_dumper *dumper)
@@ -533,6 +534,7 @@ abs_time_to_rfc3339(wmem_allocator_t *scope, const nstime_t *nstime, bool use_ut
/* Dissect field value based on a specific type. */
static void
+// NOLINTNEXTLINE(misc-no-recursion)
protobuf_dissect_field_value(proto_tree *value_tree, tvbuff_t *tvb, guint offset, guint length, packet_info *pinfo,
proto_item *ti_field, int field_type, const guint64 value, const gchar* prepend_text, const PbwFieldDescriptor* field_desc,
gboolean is_top_level, json_dumper *dumper)
@@ -840,6 +842,7 @@ protobuf_dissect_field_value(proto_tree *value_tree, tvbuff_t *tvb, guint offset
/* add all possible values according to field types. */
static void
+// NOLINTNEXTLINE(misc-no-recursion)
protobuf_try_dissect_field_value_on_multi_types(proto_tree *value_tree, tvbuff_t *tvb, guint offset, guint length,
packet_info *pinfo, proto_item *ti_field, int* field_types, const guint64 value, const gchar* prepend_text,
json_dumper *dumper)
@@ -857,6 +860,7 @@ protobuf_try_dissect_field_value_on_multi_types(proto_tree *value_tree, tvbuff_t
}
static gboolean
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_one_protobuf_field(tvbuff_t *tvb, guint* offset, guint maxlen, packet_info *pinfo, proto_tree *protobuf_tree,
const PbwDescriptor* message_desc, gboolean is_top_level, const PbwFieldDescriptor** field_desc_ptr,
const PbwFieldDescriptor* prev_field_desc, json_dumper *dumper)
@@ -1002,6 +1006,7 @@ dissect_one_protobuf_field(tvbuff_t *tvb, guint* offset, guint maxlen, packet_in
/* add value subtree. we add uint value for numeric field or string for length-delimited at least. */
value_tree = proto_item_add_subtree(ti_value, ett_protobuf_value);
+ increment_dissection_depth(pinfo);
if (field_desc) {
if (dumper) {
if (prev_field_desc == NULL || pbw_FieldDescriptor_number(prev_field_desc) != (int) field_number) {
@@ -1043,6 +1048,7 @@ dissect_one_protobuf_field(tvbuff_t *tvb, guint* offset, guint maxlen, packet_in
ti_field, field_types, value_uint64, "", dumper);
}
}
+ decrement_dissection_depth(pinfo);
if (field_desc && !show_details) {
proto_item_set_hidden(ti_field_number);
@@ -1369,6 +1375,7 @@ add_missing_fields_with_default_values(tvbuff_t* tvb, guint offset, packet_info*
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_protobuf_message(tvbuff_t *tvb, guint offset, guint length, packet_info *pinfo, proto_tree *protobuf_tree,
const PbwDescriptor* message_desc, int hf_msg, gboolean is_top_level, json_dumper *dumper, wmem_allocator_t* scope, char** retval)
{
@@ -1452,6 +1459,7 @@ dissect_protobuf_message(tvbuff_t *tvb, guint offset, guint length, packet_info
}
/* each time we dissect one protobuf field. */
+ increment_dissection_depth(pinfo);
while (offset < max_offset)
{
field_desc = NULL;
@@ -1465,6 +1473,7 @@ dissect_protobuf_message(tvbuff_t *tvb, guint offset, guint length, packet_info
prev_field_desc = field_desc;
}
+ decrement_dissection_depth(pinfo);
if (dumper && prev_field_desc && pbw_FieldDescriptor_is_repeated(prev_field_desc)) {
/* The last field is repeated field, we close the JSON array */
@@ -1655,7 +1664,8 @@ dissect_protobuf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
}
static gboolean
-load_all_files_in_dir(PbwDescriptorPool* pool, const gchar* dir_path)
+// NOLINTNEXTLINE(misc-no-recursion)
+load_all_files_in_dir(PbwDescriptorPool* pool, const gchar* dir_path, unsigned depth)
{
WS_DIR *dir; /* scanned directory */
WS_DIRENT *file; /* current file */
@@ -1663,6 +1673,10 @@ load_all_files_in_dir(PbwDescriptorPool* pool, const gchar* dir_path)
const gchar *name; /* current file or dir name (without parent dir path) */
gchar *path; /* sub file or dir path of dir_path */
+ if (depth > prefs.gui_max_tree_depth) {
+ return FALSE;
+ }
+
if (g_file_test(dir_path, G_FILE_TEST_IS_DIR)) {
if ((dir = ws_dir_open(dir_path, 0, NULL)) != NULL) {
while ((file = ws_dir_read_name(dir)) != NULL) {
@@ -1678,7 +1692,7 @@ load_all_files_in_dir(PbwDescriptorPool* pool, const gchar* dir_path)
return FALSE;
}
} else {
- if (!load_all_files_in_dir(pool, path)) {
+ if (!load_all_files_in_dir(pool, path, depth + 1)) {
g_free(path);
ws_dir_close(dir);
return FALSE;
@@ -1994,7 +2008,7 @@ protobuf_reinit(int target)
/* load all .proto files in the marked search paths, we can invoke FindMethodByName etc later. */
for (i = 0; i < num_proto_paths; ++i) {
if ((i < 2) || protobuf_search_paths[i - 2].load_all) {
- if (!load_all_files_in_dir(pbw_pool, source_paths[i])) {
+ if (!load_all_files_in_dir(pbw_pool, source_paths[i], 0)) {
buffer_error("Protobuf: Loading .proto files action stopped!\n");
loading_completed = FALSE;
break; /* stop loading when error occurs */
diff --git a/epan/dissectors/packet-proxy.c b/epan/dissectors/packet-proxy.c
index b45eb872..2e41ff54 100644
--- a/epan/dissectors/packet-proxy.c
+++ b/epan/dissectors/packet-proxy.c
@@ -245,8 +245,10 @@ dissect_proxy_proxied(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree,
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_proxy_v2_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *proxy_tree, int offset, int next_offset)
{
+ increment_dissection_depth(pinfo);
while (offset < next_offset) {
guint32 type, length;
proto_item *ti_tlv;
@@ -298,6 +300,7 @@ dissect_proxy_v2_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *proxy_tree,
break;
}
}
+ decrement_dissection_depth(pinfo);
return offset;
}
diff --git a/epan/dissectors/packet-q2931.c b/epan/dissectors/packet-q2931.c
index 2749db08..348707e9 100644
--- a/epan/dissectors/packet-q2931.c
+++ b/epan/dissectors/packet-q2931.c
@@ -1127,6 +1127,7 @@ static const value_string q2931_rejection_reason_vals[] = {
static const true_false_string tfs_abnormal_normal = { "Abnormal", "Normal" };
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_q2931_cause_ie(tvbuff_t *tvb, packet_info* pinfo, int offset, int len,
proto_tree *tree)
{
@@ -1201,6 +1202,7 @@ dissect_q2931_cause_ie(tvbuff_t *tvb, packet_info* pinfo, int offset, int len,
info_element = tvb_get_guint8(tvb, offset);
info_element_ext = tvb_get_guint8(tvb, offset + 1);
info_element_len = tvb_get_ntohs(tvb, offset + 2);
+ // We recurse here, but we'll run out of packet before we run out of stack.
dissect_q2931_ie(tvb, pinfo, offset, info_element_len, tree,
info_element, info_element_ext);
break;
@@ -1716,6 +1718,7 @@ dissect_q2931_endpoint_state_ie(tvbuff_t *tvb, int offset, int len,
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_q2931_ie_contents(tvbuff_t *tvb, packet_info* pinfo, int offset, int len,
proto_tree *tree, guint8 info_element)
{
@@ -1774,6 +1777,7 @@ dissect_q2931_ie_contents(tvbuff_t *tvb, packet_info* pinfo, int offset, int len
break;
case Q2931_IE_CAUSE:
+ // We recurse here, but we'll run out of packet before we run out of stack.
dissect_q2931_cause_ie(tvb, pinfo, offset, len, tree);
break;
@@ -1820,6 +1824,7 @@ dissect_q2931_ie_contents(tvbuff_t *tvb, packet_info* pinfo, int offset, int len
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_q2931_ie(tvbuff_t *tvb, packet_info* pinfo, int offset, int len, proto_tree *tree,
guint8 info_element, guint8 info_element_ext)
{
@@ -1842,6 +1847,7 @@ dissect_q2931_ie(tvbuff_t *tvb, packet_info* pinfo, int offset, int len, proto_t
if ((info_element_ext & Q2931_IE_COMPAT_CODING_STD)
== Q2931_ITU_STANDARDIZED_CODING) {
+ // We recurse here, but we'll run out of packet before we run out of stack.
dissect_q2931_ie_contents(tvb, pinfo, offset + 4,
len, ie_tree, info_element);
} else {
diff --git a/epan/dissectors/packet-qnet6.c b/epan/dissectors/packet-qnet6.c
index e081b9e0..ffa22d92 100644
--- a/epan/dissectors/packet-qnet6.c
+++ b/epan/dissectors/packet-qnet6.c
@@ -1956,6 +1956,11 @@ dissect_qnet6_kif_msgsend_msg_msginfo(tvbuff_t * tvb, packet_info * pinfo _U_, p
}
+// Most of the functions below recurse via dissect_qnet6_kif_msgsend_msg.
+// We're guaranteed to run out of packet before we run out of stack, so
+// just skip over them.
+// NOLINTBEGIN(misc-no-recursion)
+
/*
* in dissect_qnet6_kif_msgsend_msg already passed the first 2 bytes
* msg->type and when dissect_qnet6_kif_msgsend_msg_devctl is called, it
@@ -3254,6 +3259,8 @@ dissect_qnet6_kif_msgsend_msg(tvbuff_t * tvb, packet_info * pinfo, proto_tree *
return ret;
}
+// NOLINTEND(misc-no-recursion)
+
static void
qos_tcs_init_addtree(tvbuff_t * tvb, proto_tree * tree, gint * poffset, guint encoding, int hf_off, int hf_generated, gint rlen, gint name_start)
{
diff --git a/epan/dissectors/packet-rdp.c b/epan/dissectors/packet-rdp.c
index b9457a17..370cbee2 100644
--- a/epan/dissectors/packet-rdp.c
+++ b/epan/dissectors/packet-rdp.c
@@ -1328,6 +1328,7 @@ rdp_get_conversation_data(packet_info *pinfo)
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_rdp_fields(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const rdp_field_info_t *fields, int totlen)
{
const rdp_field_info_t *c;
@@ -1336,6 +1337,8 @@ dissect_rdp_fields(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr
guint32 info_flags = 0;
guint encoding;
+ increment_dissection_depth(pinfo);
+
for ( ; fields->pfield != NULL; fields++) {
c = fields;
if ((c->fixedLength == 0) && (c->variableLength)) {
@@ -1406,6 +1409,7 @@ dissect_rdp_fields(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr
/* XXX: err if > totlen ?? */
}
+ decrement_dissection_depth(pinfo);
return offset;
}
diff --git a/epan/dissectors/packet-resp.c b/epan/dissectors/packet-resp.c
index 19bf2e4a..b2216b27 100644
--- a/epan/dissectors/packet-resp.c
+++ b/epan/dissectors/packet-resp.c
@@ -188,6 +188,7 @@ static int dissect_resp_integer(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
return bulk_string_string_length + CRLF_LENGTH;
}
+// NOLINTNEXTLINE(misc-no-recursion)
static int dissect_resp_array(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, gint string_length, gint array_depth) {
guint8 *array_length_as_string = tvb_get_string_enc(wmem_packet_scope(), tvb, offset + RESP_TOKEN_PREFIX_LENGTH,
string_length - RESP_TOKEN_PREFIX_LENGTH, ENC_ASCII);
@@ -254,6 +255,7 @@ static int dissect_resp_array(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
return dissected_offset - offset;
}
+// NOLINTNEXTLINE(misc-no-recursion)
static int dissect_resp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, gint string_length, gint array_depth) {
switch (tvb_get_guint8(tvb, offset)) {
case '+':
@@ -282,6 +284,7 @@ static int dissect_resp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
}
}
+// NOLINTNEXTLINE(misc-no-recursion)
static int dissect_resp_loop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, gint array_depth, gint64 expected_elements) {
gint error_or_offset;
gint crlf_string_line_length;
@@ -300,7 +303,9 @@ static int dissect_resp_loop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT;
return -1;
}
+ increment_dissection_depth(pinfo);
error_or_offset = dissect_resp_message(tvb, pinfo, tree, offset, crlf_string_line_length, array_depth);
+ decrement_dissection_depth(pinfo);
if (error_or_offset == -1) {
return -1;
}
diff --git a/epan/dissectors/packet-rpl.c b/epan/dissectors/packet-rpl.c
index 9dcfb53b..c39e74a5 100644
--- a/epan/dissectors/packet-rpl.c
+++ b/epan/dissectors/packet-rpl.c
@@ -83,6 +83,7 @@ static const value_string rpl_type_vals[] = {
};
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_rpl_container(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
guint16 len, type, sublen, subtyp;
@@ -383,8 +384,7 @@ proto_register_rpl(void)
&ett_rpl_unkn
};
- proto_rpl = proto_register_protocol("Remote Program Load",
- "RPL", "rpl");
+ proto_rpl = proto_register_protocol("Remote Program Load", "RPL", "rpl");
proto_register_field_array(proto_rpl, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
rpl_handle = register_dissector("rpl", dissect_rpl, proto_rpl);
diff --git a/epan/dissectors/packet-rsl.c b/epan/dissectors/packet-rsl.c
index 08757864..4f3b8686 100644
--- a/epan/dissectors/packet-rsl.c
+++ b/epan/dissectors/packet-rsl.c
@@ -2576,6 +2576,7 @@ dissect_rsl_ie_ms_timing_offset(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tre
* which was considered erroneous at reception.
*/
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_rsl_ie_err_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, gboolean is_mandatory)
{
proto_item *ti;
@@ -3907,6 +3908,7 @@ dissct_rsl_ipaccess_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
guint8 msg_disc, msg_type, sys_info_type;
@@ -3922,6 +3924,7 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
}
offset++;
+ increment_dissection_depth(pinfo);
switch (msg_type) {
/* Radio Link Layer Management messages */
/* 8.3.1 DATA REQUEST */
@@ -4573,6 +4576,7 @@ dissct_rsl_msg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
default:
break;
}
+ decrement_dissection_depth(pinfo);
return offset;
diff --git a/epan/dissectors/packet-rsvp.c b/epan/dissectors/packet-rsvp.c
index 34983c70..b271d422 100644
--- a/epan/dissectors/packet-rsvp.c
+++ b/epan/dissectors/packet-rsvp.c
@@ -2948,6 +2948,7 @@ dissect_rsvp_session(packet_info *pinfo, proto_item *ti, proto_tree *rsvp_object
* (TODO: TLV type 12, 13, 25)
*------------------------------------------------------------------------------*/
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_rsvp_ifid_tlv(proto_tree *ti, packet_info* pinfo, proto_tree *rsvp_object_tree,
tvbuff_t *tvb, int offset, int length,
int subtree_type)
@@ -3156,8 +3157,10 @@ dissect_rsvp_ifid_tlv(proto_tree *ti, packet_info* pinfo, proto_tree *rsvp_objec
proto_tree_add_uint_format_value(rsvp_ifid_subtree, hf_rsvp_type, tvb, offset+tlv_off, 2,
tlv_type, "%d (%s-Exclusions)", tlv_type, tlv_name);
proto_tree_add_item(rsvp_ifid_subtree, hf_rsvp_ifid_tlv_length, tvb, offset+tlv_off+2, 2, ENC_BIG_ENDIAN);
+ increment_dissection_depth(pinfo);
dissect_rsvp_ifid_tlv(ti2, pinfo, rsvp_ifid_subtree, tvb, offset+tlv_off+4,
tlv_len-4, TREE(TT_HOP_SUBOBJ));
+ decrement_dissection_depth(pinfo);
break;
case 516:
/* FF: ERROR_STRING TLV, RFC 4783 */
@@ -7585,6 +7588,7 @@ dissect_rsvp_unknown(proto_tree *ti _U_,
* Dissect a single RSVP message in a tree
*------------------------------------------------------------------------------*/
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_rsvp_msg_tree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
int tree_mode, rsvp_conversation_info *rsvph, gboolean e2ei)
{
@@ -7671,7 +7675,9 @@ dissect_rsvp_msg_tree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
tvbuff_t *tvb_sub;
sub_len = tvb_get_ntohs(tvb, len2+6);
tvb_sub = tvb_new_subset_length(tvb, len2, sub_len);
+ increment_dissection_depth(pinfo);
dissect_rsvp_msg_tree(tvb_sub, pinfo, rsvp_tree, TREE(TT_BUNDLE_COMPMSG), rsvph, e2ei);
+ decrement_dissection_depth(pinfo);
len2 += sub_len;
}
} else {
diff --git a/epan/dissectors/packet-rtls.c b/epan/dissectors/packet-rtls.c
index 95c56819..af4b9b4b 100644
--- a/epan/dissectors/packet-rtls.c
+++ b/epan/dissectors/packet-rtls.c
@@ -212,6 +212,7 @@ dissect_rtls_header(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *rtls_tree
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_rtls_message_type(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *rtls_tree, guint offset, guint type)
{
proto_item *ti_rssi;
@@ -361,6 +362,7 @@ hf_rtls_nack_flags, ett_rtls_nack_flags, rtls_nack_flags, ENC_BIG_ENDIAN, BMT_NO
offset = dissect_rtls_header(tvb, pinfo, sub_tree, offset, &data_length);
+ // We recurse here, but we'll run out of packet before we run out of stack.
offset = dissect_rtls_message_type(tvb, pinfo, sub_tree, offset, type);
proto_item_set_len(sub_tree, data_length + 16);
@@ -774,6 +776,7 @@ proto_register_rtls(void)
void
proto_reg_handoff_rtls(void)
{
+ // If this is ever streamed (transported over TCP) we need to add recursion checks
dissector_add_for_decode_as_with_preference("udp.port", rtls_handle);
}
diff --git a/epan/dissectors/packet-rtmpt.c b/epan/dissectors/packet-rtmpt.c
index 7760318b..0d88ba2f 100644
--- a/epan/dissectors/packet-rtmpt.c
+++ b/epan/dissectors/packet-rtmpt.c
@@ -569,7 +569,7 @@ rtmpt_get_amf_length(tvbuff_t *tvb, gint offset, proto_item* pi)
while (rv == 0 || depth > 0) {
- if (--iterations) {
+ if (--iterations == 0) {
expert_add_info(NULL, pi, &ei_amf_loop);
return 0;
}
@@ -873,7 +873,7 @@ dissect_rtmpt_body_scm(tvbuff_t *tvb, gint offset, proto_tree *rtmpt_tree, guint
}
static gint
-dissect_amf0_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, gboolean *amf3_encoding, proto_item *parent_ti);
+dissect_amf0_value_type(tvbuff_t *tvb, packet_info *pinfo, gint offset, proto_tree *tree, gboolean *amf3_encoding, proto_item *parent_ti);
/*
* A "property list" is a sequence of name/value pairs, terminated by
@@ -881,7 +881,8 @@ dissect_amf0_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, gboolean *
* are encoded as property lists.
*/
static gint
-dissect_amf0_property_list(tvbuff_t *tvb, gint offset, proto_tree *tree, guint *countp, gboolean *amf3_encoding)
+// NOLINTNEXTLINE(misc-no-recursion)
+dissect_amf0_property_list(tvbuff_t *tvb, packet_info *pinfo, gint offset, proto_tree *tree, guint *countp, gboolean *amf3_encoding)
{
proto_item *prop_ti;
proto_tree *prop_tree;
@@ -918,7 +919,7 @@ dissect_amf0_property_list(tvbuff_t *tvb, gint offset, proto_tree *tree, guint *
offset += iStringLength;
/* value-type: property value */
- offset = dissect_amf0_value_type(tvb, offset, prop_tree, amf3_encoding, prop_ti);
+ offset = dissect_amf0_value_type(tvb, pinfo, offset, prop_tree, amf3_encoding, prop_ti);
proto_item_set_end(prop_ti, tvb, offset);
}
proto_tree_add_item(tree, hf_amf_end_of_object_marker, tvb, offset, 3, ENC_NA);
@@ -930,7 +931,8 @@ dissect_amf0_property_list(tvbuff_t *tvb, gint offset, proto_tree *tree, guint *
}
static gint
-dissect_amf0_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, gboolean *amf3_encoding, proto_item *parent_ti)
+// NOLINTNEXTLINE(misc-no-recursion)
+dissect_amf0_value_type(tvbuff_t *tvb, packet_info *pinfo, gint offset, proto_tree *tree, gboolean *amf3_encoding, proto_item *parent_ti)
{
guint8 iObjType;
proto_item *ti;
@@ -993,6 +995,7 @@ dissect_amf0_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, gboolean *
proto_tree_add_uint(val_tree, hf_amf_amf0_type, tvb, iValueOffset, 1, iObjType);
iValueOffset++;
+ increment_dissection_depth(pinfo);
switch (iObjType) {
case AMF0_NUMBER:
iDoubleValue = tvb_get_ntohieee_double(tvb, iValueOffset);
@@ -1023,7 +1026,7 @@ dissect_amf0_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, gboolean *
proto_item_append_text(parent_ti, " '%s'", iStringValue);
break;
case AMF0_OBJECT:
- iValueOffset = dissect_amf0_property_list(tvb, iValueOffset, val_tree, &count, amf3_encoding);
+ iValueOffset = dissect_amf0_property_list(tvb, pinfo, iValueOffset, val_tree, &count, amf3_encoding);
proto_item_append_text(ti, " (%u items)", count);
break;
case AMF0_NULL:
@@ -1050,7 +1053,7 @@ dissect_amf0_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, gboolean *
iArrayLength = tvb_get_ntohl(tvb, iValueOffset);
proto_tree_add_uint(val_tree, hf_amf_arraylength, tvb, iValueOffset, 4, iArrayLength);
iValueOffset += 4;
- iValueOffset = dissect_amf0_property_list(tvb, iValueOffset, val_tree, &count, amf3_encoding);
+ iValueOffset = dissect_amf0_property_list(tvb, pinfo, iValueOffset, val_tree, &count, amf3_encoding);
proto_item_append_text(ti, " (%u items)", count);
break;
case AMF0_END_OF_OBJECT:
@@ -1068,7 +1071,7 @@ dissect_amf0_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, gboolean *
proto_tree_add_uint(val_tree, hf_amf_arraylength, tvb, iValueOffset, 4, iArrayLength);
iValueOffset += 4;
for (i = 0; i < iArrayLength; i++)
- iValueOffset = dissect_amf0_value_type(tvb, iValueOffset, val_tree, amf3_encoding, NULL);
+ iValueOffset = dissect_amf0_value_type(tvb, pinfo, iValueOffset, val_tree, amf3_encoding, NULL);
proto_item_append_text(ti, " (%u items)", iArrayLength);
break;
case AMF0_DATE:
@@ -1106,7 +1109,7 @@ dissect_amf0_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, gboolean *
iStringValue = tvb_get_string_enc(wmem_packet_scope(), tvb, iValueOffset, iStringLength, ENC_UTF_8|ENC_NA);
proto_tree_add_string(val_tree, hf_amf_string, tvb, iValueOffset, iStringLength, iStringValue);
iValueOffset += iStringLength;
- iValueOffset = dissect_amf0_property_list(tvb, iValueOffset, val_tree, &count, amf3_encoding);
+ iValueOffset = dissect_amf0_property_list(tvb, pinfo, iValueOffset, val_tree, &count, amf3_encoding);
break;
case AMF0_AMF3_MARKER:
*amf3_encoding = TRUE;
@@ -1127,6 +1130,7 @@ dissect_amf0_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, gboolean *
iValueOffset = tvb_reported_length(tvb);
break;
}
+ decrement_dissection_depth(pinfo);
proto_item_set_end(ti, tvb, iValueOffset);
return iValueOffset;
}
@@ -1173,7 +1177,8 @@ amf_get_u29(tvbuff_t *tvb, int offset, guint *lenp)
}
static gint
-dissect_amf3_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, proto_item *parent_ti)
+// NOLINTNEXTLINE(misc-no-recursion)
+dissect_amf3_value_type(tvbuff_t *tvb, packet_info *pinfo, gint offset, proto_tree *tree, proto_item *parent_ti)
{
guint8 iObjType;
proto_item *ti;
@@ -1233,6 +1238,7 @@ dissect_amf3_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, proto_item
proto_tree_add_uint(val_tree, hf_amf_amf3_type, tvb, iValueOffset, 1, iObjType);
iValueOffset++;
+ increment_dissection_depth(pinfo);
switch (iObjType) {
case AMF3_UNDEFINED:
case AMF3_NULL:
@@ -1365,14 +1371,14 @@ dissect_amf3_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, proto_item
proto_item_append_text(subval_ti, "%s",
val_to_str_const(iObjType, amf3_type_vals, "Unknown"));
- iValueOffset = dissect_amf3_value_type(tvb, iValueOffset, subval_tree, subval_ti);
+ iValueOffset = dissect_amf3_value_type(tvb, pinfo, iValueOffset, subval_tree, subval_ti);
}
/*
* Dissect the dense portion.
*/
for (i = 0; i < iArrayLength; i++)
- iValueOffset = dissect_amf3_value_type(tvb, iValueOffset, val_tree, NULL);
+ iValueOffset = dissect_amf3_value_type(tvb, pinfo, iValueOffset, val_tree, NULL);
proto_item_set_end(ti, tvb, iValueOffset);
} else {
@@ -1450,7 +1456,7 @@ dissect_amf3_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, proto_item
}
}
for (i = 0; i < iTraitCount; i++)
- iValueOffset = dissect_amf3_value_type(tvb, iValueOffset, traits_tree, NULL);
+ iValueOffset = dissect_amf3_value_type(tvb, pinfo, iValueOffset, traits_tree, NULL);
if (iTypeIsDynamic) {
for (;;) {
/* Fetch the name */
@@ -1485,7 +1491,7 @@ dissect_amf3_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, proto_item
}
/* Fetch the value */
- iValueOffset = dissect_amf3_value_type(tvb, iValueOffset, subval_tree, subval_ti);
+ iValueOffset = dissect_amf3_value_type(tvb, pinfo, iValueOffset, subval_tree, subval_ti);
proto_item_set_end(subval_ti, tvb, iValueOffset);
}
}
@@ -1563,12 +1569,13 @@ dissect_amf3_value_type(tvbuff_t *tvb, gint offset, proto_tree *tree, proto_item
iValueOffset = tvb_reported_length(tvb);
break;
}
+ decrement_dissection_depth(pinfo);
proto_item_set_end(ti, tvb, iValueOffset);
return iValueOffset;
}
static gint
-dissect_rtmpt_body_command(tvbuff_t *tvb, gint offset, proto_tree *rtmpt_tree, gboolean amf3)
+dissect_rtmpt_body_command(tvbuff_t *tvb, packet_info *pinfo, gint offset, proto_tree *rtmpt_tree, gboolean amf3)
{
gboolean amf3_encoding = FALSE;
@@ -1584,9 +1591,9 @@ dissect_rtmpt_body_command(tvbuff_t *tvb, gint offset, proto_tree *rtmpt_tree, g
while (tvb_reported_length_remaining(tvb, offset) > 0)
{
if (amf3_encoding)
- offset = dissect_amf3_value_type(tvb, offset, rtmpt_tree, NULL);
+ offset = dissect_amf3_value_type(tvb, pinfo, offset, rtmpt_tree, NULL);
else
- offset = dissect_amf0_value_type(tvb, offset, rtmpt_tree, &amf3_encoding, NULL);
+ offset = dissect_amf0_value_type(tvb, pinfo, offset, rtmpt_tree, &amf3_encoding, NULL);
}
return offset;
}
@@ -1634,7 +1641,7 @@ dissect_rtmpt_body_video(tvbuff_t *tvb, gint offset, proto_tree *rtmpt_tree)
}
static void
-dissect_rtmpt_body_aggregate(tvbuff_t *tvb, gint offset, proto_tree *rtmpt_tree)
+dissect_rtmpt_body_aggregate(tvbuff_t *tvb, packet_info *pinfo, gint offset, proto_tree *rtmpt_tree)
{
proto_tree *tag_tree;
@@ -1665,7 +1672,7 @@ dissect_rtmpt_body_aggregate(tvbuff_t *tvb, gint offset, proto_tree *rtmpt_tree)
dissect_rtmpt_body_video(tvb, offset + 11, data_tree);
break;
case 18:
- dissect_rtmpt_body_command(tvb, offset + 11, data_tree, FALSE);
+ dissect_rtmpt_body_command(tvb, pinfo, offset + 11, data_tree, FALSE);
break;
default:
break;
@@ -1842,11 +1849,11 @@ dissect_rtmpt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_conv_t
break;
case RTMPT_TYPE_COMMAND_AMF0:
case RTMPT_TYPE_DATA_AMF0:
- dissect_rtmpt_body_command(tvb, offset, rtmpt_tree, FALSE);
+ dissect_rtmpt_body_command(tvb, pinfo, offset, rtmpt_tree, FALSE);
break;
case RTMPT_TYPE_COMMAND_AMF3:
case RTMPT_TYPE_DATA_AMF3:
- dissect_rtmpt_body_command(tvb, offset, rtmpt_tree, TRUE);
+ dissect_rtmpt_body_command(tvb, pinfo, offset, rtmpt_tree, TRUE);
break;
case RTMPT_TYPE_AUDIO_DATA:
dissect_rtmpt_body_audio(tvb, offset, rtmpt_tree);
@@ -1855,7 +1862,7 @@ dissect_rtmpt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, rtmpt_conv_t
dissect_rtmpt_body_video(tvb, offset, rtmpt_tree);
break;
case RTMPT_TYPE_AGGREGATE:
- dissect_rtmpt_body_aggregate(tvb, offset, rtmpt_tree);
+ dissect_rtmpt_body_aggregate(tvb, pinfo, offset, rtmpt_tree);
break;
}
}
@@ -2500,7 +2507,7 @@ dissect_rtmpt_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
}
static int
-dissect_amf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)
+dissect_amf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
proto_item *ti;
proto_tree *amf_tree, *headers_tree, *messages_tree;
@@ -2536,9 +2543,9 @@ dissect_amf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data
proto_tree_add_uint(headers_tree, hf_amf_header_length, tvb, offset, 4, header_length);
offset += 4;
if (amf3_encoding)
- offset = dissect_amf3_value_type(tvb, offset, headers_tree, NULL);
+ offset = dissect_amf3_value_type(tvb, pinfo, offset, headers_tree, NULL);
else
- offset = dissect_amf0_value_type(tvb, offset, headers_tree, &amf3_encoding, NULL);
+ offset = dissect_amf0_value_type(tvb, pinfo, offset, headers_tree, &amf3_encoding, NULL);
}
}
message_count = tvb_get_ntohs(tvb, offset);
@@ -2559,7 +2566,7 @@ dissect_amf(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data
else
proto_tree_add_uint(messages_tree, hf_amf_message_length, tvb, offset, 4, message_length);
offset += 4;
- offset = dissect_rtmpt_body_command(tvb, offset, messages_tree, FALSE);
+ offset = dissect_rtmpt_body_command(tvb, pinfo, offset, messages_tree, FALSE);
}
}
return tvb_captured_length(tvb);
diff --git a/epan/dissectors/packet-rtp.c b/epan/dissectors/packet-rtp.c
index 9f7ecea1..9e34b914 100644
--- a/epan/dissectors/packet-rtp.c
+++ b/epan/dissectors/packet-rtp.c
@@ -1185,6 +1185,7 @@ srtp_add_address(packet_info *pinfo, const port_type ptype, address *addr, int p
conversation_t* p_conv, *sdp_conv;
struct _rtp_conversation_info *p_conv_data;
wmem_array_t *rtp_conv_info_list = NULL;
+ wmem_map_t *ssrc_number_space = NULL;
/*
* If this isn't the first time this packet has been processed,
@@ -1213,10 +1214,20 @@ srtp_add_address(packet_info *pinfo, const port_type ptype, address *addr, int p
if (p_conv) {
/*
* Check if the conversation has data associated with it.
+ * Sometimes there are multiple setup messages for the same
+ * conversation, and it's worth copying over some of our
+ * internal data to the new conversation. The extended sequence
+ * number and timestamp cycle information is per-SSRC, and it
+ * doesn't hurt (and can definitely help) to ensure that the
+ * new conversation uses the same extended cycles as the old one.
+ * XXX: It's not actually clear that we really need to create
+ * extra conversations for each setup frame, because we save the
+ * relevant information to per-packet data for the subsequent passes.
*/
p_conv_data = (struct _rtp_conversation_info *)conversation_get_proto_data(p_conv, proto_rtp);
if (p_conv_data) {
rtp_conv_info_list = p_conv_data->rtp_sdp_setup_info_list;
+ ssrc_number_space = p_conv_data->ssrc_number_space;
}
}
@@ -1266,7 +1277,7 @@ srtp_add_address(packet_info *pinfo, const port_type ptype, address *addr, int p
/* Create conversation data */
p_conv_data = wmem_new0(wmem_file_scope(), struct _rtp_conversation_info);
- p_conv_data->ssrc_number_space = wmem_map_new(wmem_file_scope(), g_direct_hash, g_direct_equal);
+ p_conv_data->ssrc_number_space = ssrc_number_space ? ssrc_number_space : wmem_map_new(wmem_file_scope(), g_direct_hash, g_direct_equal);
p_conv_data->rtp_conv_info = wmem_new(wmem_file_scope(), rtp_private_conv_info);
p_conv_data->rtp_conv_info->multisegment_pdus = wmem_tree_new(wmem_file_scope());
DINDENT();
diff --git a/epan/dissectors/packet-rtps.c b/epan/dissectors/packet-rtps.c
index f278368e..a6fb03d9 100644
--- a/epan/dissectors/packet-rtps.c
+++ b/epan/dissectors/packet-rtps.c
@@ -2859,7 +2859,7 @@ static gint dissect_crypto_algorithm_requirements(proto_tree *tree , tvbuff_t* t
return offset;
}
-static gint dissect_mutable_member(proto_tree *tree , tvbuff_t * tvb, gint offset, guint encoding, guint encoding_version,
+static gint dissect_mutable_member(proto_tree *tree , tvbuff_t * tvb, packet_info *pinfo, gint offset, guint encoding, guint encoding_version,
dissection_info * info, gboolean * is_end, gboolean show);
static gint get_native_type_cdr_length(guint64 member_kind) {
@@ -3008,7 +3008,8 @@ static dissection_info* lookup_dissection_info_in_custom_and_builtin_types(guint
}
/* this is a recursive function. _info may or may not be NULL depending on the use iteration */
-static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset, guint encoding, guint encoding_version,
+// NOLINTNEXTLINE(misc-no-recursion)
+static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, packet_info *pinfo, gint offset, guint encoding, guint encoding_version,
dissection_info * _info, guint64 type_id, gchar * name,
RTICdrTypeObjectExtensibility extensibility, gint offset_zero,
guint16 flags, guint32 element_member_id, gboolean show) {
@@ -3064,6 +3065,7 @@ static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset,
}
//proto_item_append_text(tree, "(Before Switch 0x%016" PRIx64 ")", type_id);
+ increment_dissection_depth(pinfo);
switch (member_kind) {
case RTI_CDR_TYPE_OBJECT_TYPE_KIND_BOOLEAN_TYPE: {
gint length = get_native_type_cdr_length(member_kind);
@@ -3237,7 +3239,7 @@ static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset,
break;
}
}
- offset = dissect_user_defined(aux_tree, tvb, offset, encoding, encoding_version, NULL,
+ offset = dissect_user_defined(aux_tree, tvb, pinfo, offset, encoding, encoding_version, NULL,
info->base_type_id, temp_buff, EXTENSIBILITY_INVALID, offset_zero, 0, 0, show_current_element);
}
@@ -3310,7 +3312,7 @@ static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset,
}
}
if (info != NULL && info->base_type_id > 0)
- offset = dissect_user_defined(aux_tree, tvb, offset, encoding, encoding_version, NULL,
+ offset = dissect_user_defined(aux_tree, tvb, pinfo, offset, encoding, encoding_version, NULL,
info->base_type_id, temp_buff, EXTENSIBILITY_INVALID, offset_zero, 0, 0, show_current_element);
}
/* If reached the limit and there are remaining elements we need to show the message and
@@ -3351,7 +3353,7 @@ static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset,
if (info != NULL) {
base_type_id = info->base_type_id;
}
- offset = dissect_user_defined(tree, tvb, offset, encoding, encoding_version, NULL,
+ offset = dissect_user_defined(tree, tvb, pinfo, offset, encoding, encoding_version, NULL,
base_type_id, name, EXTENSIBILITY_INVALID, offset_zero, 0, 0, show);
break;
}
@@ -3369,7 +3371,7 @@ static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset,
proto_item_append_text(tree, " (discriminator = %d, type_id = 0x%016" PRIx64 ")",
value, result->member_type_id);
}
- offset = dissect_user_defined(tree, tvb, offset, encoding, encoding_version, NULL,
+ offset = dissect_user_defined(tree, tvb, pinfo, offset, encoding, encoding_version, NULL,
result->member_type_id, result->member_name, EXTENSIBILITY_INVALID, offset, 0, 0, show);
} else {
/* the hashmap uses the type_id to index the objects. substracting -2 here to lookup the discriminator
@@ -3381,7 +3383,7 @@ static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset,
proto_item_append_text(tree, " (discriminator = %d, type_id = 0x%016" PRIx64 ")",
value, result->member_type_id);
}
- offset = dissect_user_defined(tree, tvb, offset, encoding, encoding_version, NULL,
+ offset = dissect_user_defined(tree, tvb, pinfo, offset, encoding, encoding_version, NULL,
result->member_type_id, result->member_name, EXTENSIBILITY_INVALID, offset, 0, 0, show);
}
}
@@ -3414,7 +3416,7 @@ static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset,
/* Updated only once */
first_skipped_element_offset = offset;
}
- offset = dissect_mutable_member(aux_tree, tvb, offset, encoding, encoding_version, info, &is_end, show_current_element);
+ offset = dissect_mutable_member(aux_tree, tvb, pinfo, offset, encoding, encoding_version, info, &is_end, show_current_element);
++num_elements;
if (show_current_element) {
++shown_elements;
@@ -3426,7 +3428,7 @@ static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset,
if (show) {
proto_item_append_text(tree, "(BaseId: 0x%016" PRIx64 ")", info->base_type_id);
}
- offset = dissect_user_defined(aux_tree, tvb, offset, encoding, encoding_version, NULL,
+ offset = dissect_user_defined(aux_tree, tvb, pinfo, offset, encoding, encoding_version, NULL,
info->base_type_id, info->member_name, EXTENSIBILITY_INVALID,
offset, 0, 0, show);
}
@@ -3445,7 +3447,7 @@ static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset,
first_skipped_element_offset = offset;
}
/* If a member is not shown all it children will inherit the "show_current_element" value */
- offset = dissect_user_defined(aux_tree, tvb, offset, encoding, encoding_version, NULL,
+ offset = dissect_user_defined(aux_tree, tvb, pinfo, offset, encoding, encoding_version, NULL,
info->elements[i].type_id, info->elements[i].member_name, info->extensibility,
offset_zero, info->elements[i].flags, info->elements[i].member_id, show_current_element);
}
@@ -3476,6 +3478,7 @@ static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset,
break;
}
}
+ decrement_dissection_depth(pinfo);
if (extensibility == EXTENSIBILITY_MUTABLE) {
offset_zero += member_length;
@@ -3485,7 +3488,8 @@ static gint dissect_user_defined(proto_tree *tree, tvbuff_t * tvb, gint offset,
}
}
-static gint dissect_mutable_member(proto_tree *tree , tvbuff_t * tvb, gint offset, guint encoding, guint encoding_version,
+// NOLINTNEXTLINE(misc-no-recursion)
+static gint dissect_mutable_member(proto_tree *tree , tvbuff_t * tvb, packet_info *pinfo, gint offset, guint encoding, guint encoding_version,
dissection_info * info, gboolean * is_end, gboolean show) {
proto_tree * member;
@@ -3514,7 +3518,7 @@ static gint dissect_mutable_member(proto_tree *tree , tvbuff_t * tvb, gint offse
mapping = (mutable_member_mapping *) wmem_map_lookup(mutable_member_mappings, &(key));
if (mapping) { /* the library knows how to dissect this */
proto_item_append_text(member, "(base found 0x%016" PRIx64 ")", key);
- dissect_user_defined(tree, tvb, offset, encoding, encoding_version, NULL, mapping->member_type_id,
+ dissect_user_defined(tree, tvb, pinfo, offset, encoding, encoding_version, NULL, mapping->member_type_id,
mapping->member_name, EXTENSIBILITY_INVALID, offset, 0, mapping->member_id, show);
proto_item_set_hidden(member);
return check_offset_addition(offset, member_length, tree, NULL, tvb);
@@ -3528,7 +3532,7 @@ static gint dissect_mutable_member(proto_tree *tree , tvbuff_t * tvb, gint offse
mapping = (mutable_member_mapping *) wmem_map_lookup(mutable_member_mappings, &(key));
if (mapping) { /* the library knows how to dissect this */
proto_item_append_text(member, "(found 0x%016" PRIx64 ")", key);
- dissect_user_defined(tree, tvb, offset, encoding, encoding_version, NULL, mapping->member_type_id,
+ dissect_user_defined(tree, tvb, pinfo, offset, encoding, encoding_version, NULL, mapping->member_type_id,
mapping->member_name, EXTENSIBILITY_INVALID, offset, 0, mapping->member_id, show);
} else
@@ -4920,7 +4924,8 @@ static const char *rtps_util_typecode_id_to_string(guint32 typecode_id) {
/* Insert in the protocol tree the next bytes interpreted as typecode info
* Returns the number of bytes parsed
*/
-static gint rtps_util_add_typecode(proto_tree *tree, tvbuff_t *tvb, gint offset, const guint encoding,
+// NOLINTNEXTLINE(misc-no-recursion)
+static gint rtps_util_add_typecode(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset, const guint encoding,
int indent_level, int is_pointer, guint16 bitfield, int is_key, const gint offset_begin,
char *name,
int seq_max_len, /* -1 = not a sequence field */
@@ -5064,9 +5069,11 @@ static gint rtps_util_add_typecode(proto_tree *tree, tvbuff_t *tvb, gint offset,
offset = disc_offset_begin + disc_size;
#if 0
field_offset_begin = offset;
+ increment_dissection_depth(pinfo);
offset += rtps_util_add_typecode(
tree,
tvb,
+ pinfo,
offset,
encoding,
indent_level+1,
@@ -5078,6 +5085,7 @@ static gint rtps_util_add_typecode(proto_tree *tree, tvbuff_t *tvb, gint offset,
-1,
NULL,
ndds_40_hack);
+ decrement_dissection_depth(pinfo);
#endif
/* Add the entry of the union in the tree */
@@ -5143,9 +5151,11 @@ static gint rtps_util_add_typecode(proto_tree *tree, tvbuff_t *tvb, gint offset,
proto_item_set_len(case_item, retVal);
}
- offset += rtps_util_add_typecode(tree, tvb, offset, encoding,
+ increment_dissection_depth(pinfo);
+ offset += rtps_util_add_typecode(tree, tvb, pinfo, offset, encoding,
indent_level+2, member_is_pointer, 0, 0, field_offset_begin,
member_name, -1, NULL, ndds_40_hack);
+ decrement_dissection_depth(pinfo);
}
/* Finally prints the name of the struct (if provided) */
(void) g_strlcpy(type_name, "}", sizeof(type_name));
@@ -5313,9 +5323,11 @@ static gint rtps_util_add_typecode(proto_tree *tree, tvbuff_t *tvb, gint offset,
member_is_key = tvb_get_guint8(tvb, offset);
offset++;
- offset += rtps_util_add_typecode(tree, tvb, offset, encoding,
+ increment_dissection_depth(pinfo);
+ offset += rtps_util_add_typecode(tree, tvb, pinfo, offset, encoding,
indent_level+1, member_is_pointer, member_bitfield, member_is_key,
field_offset_begin, member_name, -1, NULL, ndds_40_hack);
+ decrement_dissection_depth(pinfo);
}
}
/* Finally prints the name of the struct (if provided) */
@@ -5354,7 +5366,7 @@ static gint rtps_util_add_typecode(proto_tree *tree, tvbuff_t *tvb, gint offset,
offset += 4;
/* Recursive decode seq typecode */
- /*offset += */rtps_util_add_typecode(tree, tvb, offset, encoding, indent_level,
+ /*offset += */rtps_util_add_typecode(tree, tvb, pinfo, offset, encoding, indent_level,
is_pointer, bitfield, is_key, offset_begin, name,
seq_max_len2, NULL, ndds_40_hack);
/* Differently from the other typecodes, the line has been already printed */
@@ -5389,9 +5401,11 @@ static gint rtps_util_add_typecode(proto_tree *tree, tvbuff_t *tvb, gint offset,
}
/* Recursive decode seq typecode */
- /*offset += */rtps_util_add_typecode(tree, tvb, offset, encoding,
+ increment_dissection_depth(pinfo);
+ /*offset += */rtps_util_add_typecode(tree, tvb, pinfo, offset, encoding,
indent_level, is_pointer, bitfield, is_key, offset_begin,
name, -1, size, ndds_40_hack);
+ decrement_dissection_depth(pinfo);
/* Differently from the other typecodes, the line has been already printed */
return retVal;
}
@@ -5981,6 +5995,7 @@ static void rtps_util_add_type_element_struct(proto_tree *tree,
static void rtps_util_add_type_library(proto_tree *tree, packet_info * pinfo,
tvbuff_t * tvb, gint offset, const guint encoding, guint32 size);
+// NOLINTNEXTLINE(misc-no-recursion)
static void rtps_util_add_type_element_module(proto_tree *tree, packet_info * pinfo,
tvbuff_t * tvb, gint offset, const guint encoding) {
guint32 long_number;
@@ -5992,6 +6007,7 @@ static void rtps_util_add_type_element_module(proto_tree *tree, packet_info * pi
rtps_util_add_type_library(tree, pinfo, tvb, offset, encoding, -1);
}
+// NOLINTNEXTLINE(misc-no-recursion)
static gint rtps_util_add_type_library_element(proto_tree *tree, packet_info * pinfo,
tvbuff_t * tvb, gint offset, const guint encoding) {
proto_tree * element_tree;
@@ -6065,6 +6081,7 @@ static gint rtps_util_add_type_library_element(proto_tree *tree, packet_info * p
return offset;
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void rtps_util_add_type_library(proto_tree *tree, packet_info * pinfo,
tvbuff_t * tvb, gint offset, const guint encoding, guint32 size) {
proto_tree * library_tree;
@@ -6073,10 +6090,12 @@ static void rtps_util_add_type_library(proto_tree *tree, packet_info * pinfo,
library_tree = proto_tree_add_subtree_format(tree, tvb, offset, size,
ett_rtps_type_library, NULL, "Type Library (%d elements)", long_number);
offset += 4;
+ increment_dissection_depth(pinfo);
for (i = 0; i < long_number; i++) {
offset = rtps_util_add_type_library_element(library_tree, pinfo, tvb,
offset, encoding);
}
+ decrement_dissection_depth(pinfo);
}
static void rtps_util_add_typeobject(proto_tree *tree, packet_info * pinfo,
@@ -6753,7 +6772,7 @@ static gboolean rtps_util_try_dissector(proto_tree *tree,
info = lookup_dissection_info_in_custom_and_builtin_types(type_mapping_object->type_id);
if (info != NULL) {
proto_item_append_text(tree, " (TypeId: 0x%016" PRIx64 ")", info->type_id);
- return dissect_user_defined(tree, tvb, offset, encoding, encoding_version, info,
+ return dissect_user_defined(tree, tvb, pinfo, offset, encoding, encoding_version, info,
info->type_id, info->member_name, EXTENSIBILITY_INVALID, offset,
0 /* flags */, 0 /* member_id */, TRUE);
}
@@ -7498,6 +7517,7 @@ static gboolean dissect_parameter_sequence_rti_dds(proto_tree *rtps_parameter_tr
case PID_TYPECODE_RTPS2: {
rtps_util_add_typecode(rtps_parameter_tree,
tvb,
+ pinfo,
offset,
encoding,
0, /* indent level */
@@ -7714,6 +7734,7 @@ static gboolean dissect_parameter_sequence_toc(proto_tree *rtps_parameter_tree,
case PID_TYPECODE_RTPS2: {
rtps_util_add_typecode(rtps_parameter_tree,
tvb,
+ pinfo,
offset,
encoding,
0, /* indent level */
@@ -8608,7 +8629,7 @@ static gboolean dissect_parameter_sequence_v1(proto_tree *rtps_parameter_tree, p
* +---------------+---------------+---------------+---------------+
*/
case PID_TYPECODE:
- rtps_util_add_typecode(rtps_parameter_tree, tvb, offset, encoding,
+ rtps_util_add_typecode(rtps_parameter_tree, tvb, pinfo, offset, encoding,
0, /* indent level */
0, /* isPointer */
-1, /* bitfield */
diff --git a/epan/dissectors/packet-s7comm.c b/epan/dissectors/packet-s7comm.c
index de55b83b..5eeac7f0 100644
--- a/epan/dissectors/packet-s7comm.c
+++ b/epan/dissectors/packet-s7comm.c
@@ -4252,6 +4252,7 @@ s7comm_decode_ud_tis_param(tvbuff_t *tvb,
*
*******************************************************************************************************/
static guint32
+// NOLINTNEXTLINE(misc-no-recursion)
s7comm_decode_ud_tis_jobs(tvbuff_t *tvb,
proto_tree *td_tree,
guint16 td_size,
@@ -4309,6 +4310,7 @@ s7comm_decode_ud_tis_jobs(tvbuff_t *tvb,
}
/* New job data tree */
if (job_td_size > 0) {
+ // We recurse here, but we'll run out of packet before we run out of stack.
offset = s7comm_decode_ud_tis_data(tvb, td_tree, S7COMM_UD_TYPE_REQ, job_subfunc, job_td_size, offset);
}
break;
@@ -5122,6 +5124,7 @@ s7comm_decode_ud_tis_breakpoint(tvbuff_t *tvb,
*
*******************************************************************************************************/
static guint32
+// NOLINTNEXTLINE(misc-no-recursion)
s7comm_decode_ud_tis_data(tvbuff_t *tvb,
proto_tree *tree,
guint8 type,
@@ -5164,6 +5167,7 @@ s7comm_decode_ud_tis_data(tvbuff_t *tvb,
case S7COMM_UD_SUBF_TIS_READJOBLIST:
case S7COMM_UD_SUBF_TIS_READJOB:
case S7COMM_UD_SUBF_TIS_REPLACEJOB:
+ // We recurse here, but we'll run out of packet before we run out of stack.
offset = s7comm_decode_ud_tis_jobs(tvb, td_tree, td_size, type, subfunc, offset);
break;
case S7COMM_UD_SUBF_TIS_MODVAR:
@@ -8567,11 +8571,7 @@ proto_register_s7comm (void)
&ett_s7comm_fragment,
};
- proto_s7comm = proto_register_protocol (
- "S7 Communication", /* name */
- "S7COMM", /* short name */
- "s7comm" /* abbrev */
- );
+ proto_s7comm = proto_register_protocol ("S7 Communication", "S7COMM", "s7comm");
proto_register_field_array(proto_s7comm, hf, array_length (hf));
diff --git a/epan/dissectors/packet-scsi.c b/epan/dissectors/packet-scsi.c
index 7bb08cb7..14f22952 100644
--- a/epan/dissectors/packet-scsi.c
+++ b/epan/dissectors/packet-scsi.c
@@ -960,7 +960,8 @@ scsistat_init(struct register_srt* srt, GArray* srt_array)
scsi_srt_table = init_srt_table(tap_data->prog, NULL, srt_array, SCSI_NUM_PROCEDURES, NULL, tap_data->hf_name, tap_data);
for (i = 0; i < SCSI_NUM_PROCEDURES; i++)
{
- init_srt_table_row(scsi_srt_table, i, val_to_str_ext(i, tap_data->cdbnames_ext, "Unknown-0x%02x"));
+ init_srt_table_row(scsi_srt_table, i,
+ val_to_str_ext_const(i, tap_data->cdbnames_ext, "Unknown"));
}
}
diff --git a/epan/dissectors/packet-sctp.c b/epan/dissectors/packet-sctp.c
index f9f72a13..76348743 100644
--- a/epan/dissectors/packet-sctp.c
+++ b/epan/dissectors/packet-sctp.c
@@ -1404,6 +1404,7 @@ dissect_state_cookie_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tr
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_unrecognized_parameters_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
/* FIXME: Does it contain one or more parameters? */
@@ -1717,6 +1718,7 @@ dissect_forward_tsn_supported_parameter(tvbuff_t *parameter_tvb _U_)
#define ADDRESS_PARAMETER_OFFSET (CORRELATION_ID_OFFSET + CORRELATION_ID_LENGTH)
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_add_ip_address_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree, proto_item *parameter_item)
{
guint16 address_length;
@@ -1734,6 +1736,7 @@ dissect_add_ip_address_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, pr
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_del_ip_address_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree, proto_item *parameter_item)
{
guint16 address_length;
@@ -1753,6 +1756,7 @@ dissect_del_ip_address_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, pr
#define ERROR_CAUSE_IND_CASUES_OFFSET (CORRELATION_ID_OFFSET + CORRELATION_ID_LENGTH)
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_error_cause_indication_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
guint16 causes_length;
@@ -1767,6 +1771,7 @@ dissect_error_cause_indication_parameter(tvbuff_t *parameter_tvb, packet_info *p
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_set_primary_address_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree, proto_item *parameter_item)
{
guint16 address_length;
@@ -1886,6 +1891,7 @@ static const true_false_string sctp_parameter_bit_2_value = {
};
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo,
proto_tree *chunk_tree, proto_item *additional_item,
gboolean dissecting_init_init_ack_chunk,
@@ -1928,6 +1934,7 @@ dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo,
parameter_tree = NULL;
}
+ increment_dissection_depth(pinfo);
switch(type) {
case HEARTBEAT_INFO_PARAMETER_ID:
dissect_heartbeat_info_parameter(parameter_tvb, parameter_tree, parameter_item);
@@ -2014,6 +2021,7 @@ dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo,
dissect_unknown_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
}
+ decrement_dissection_depth(pinfo);
if (padding_length > 0) {
proto_tree_add_item(parameter_tree, hf_parameter_padding, parameter_tvb, PARAMETER_HEADER_OFFSET + length, padding_length, ENC_NA);
@@ -2021,6 +2029,7 @@ dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo,
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_parameters(tvbuff_t *parameters_tvb, packet_info *pinfo, proto_tree *tree, proto_item *additional_item, gboolean dissecting_init_init_ack_chunk)
{
gint offset, length, total_length, remaining_length;
@@ -2122,6 +2131,7 @@ dissect_out_of_resource_cause(tvbuff_t *cause_tvb _U_)
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_unresolvable_address_cause(tvbuff_t *cause_tvb, packet_info *pinfo, proto_tree *cause_tree, proto_item *cause_item)
{
guint16 parameter_length;
@@ -2138,6 +2148,7 @@ static gboolean
dissect_sctp_chunk(tvbuff_t *chunk_tvb, packet_info *pinfo, proto_tree *tree, proto_tree *sctp_tree, sctp_half_assoc_t *assoc, gboolean useinfo);
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_unrecognized_chunk_type_cause(tvbuff_t *cause_tvb, packet_info *pinfo, proto_tree *cause_tree, proto_item *cause_item)
{
guint16 chunk_length;
@@ -2159,6 +2170,7 @@ dissect_invalid_mandatory_parameter_cause(tvbuff_t *cause_tvb _U_)
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_unrecognized_parameters_cause(tvbuff_t *cause_tvb, packet_info *pinfo, proto_tree *cause_tree)
{
guint16 cause_info_length;
@@ -2188,6 +2200,7 @@ dissect_cookie_received_while_shutting_down_cause(tvbuff_t *cause_tvb _U_)
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_restart_with_new_address_cause(tvbuff_t *cause_tvb, packet_info *pinfo, proto_tree *cause_tree, proto_item *cause_item)
{
guint16 cause_info_length;
@@ -2223,6 +2236,7 @@ dissect_protocol_violation_cause(tvbuff_t *cause_tvb, proto_tree *cause_tree)
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_delete_last_address_cause(tvbuff_t *cause_tvb, packet_info *pinfo, proto_tree *cause_tree, proto_item *cause_item)
{
guint16 cause_info_length;
@@ -2238,6 +2252,7 @@ dissect_delete_last_address_cause(tvbuff_t *cause_tvb, packet_info *pinfo, proto
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_resource_outage_cause(tvbuff_t *cause_tvb, packet_info *pinfo, proto_tree *cause_tree)
{
guint16 cause_info_length;
@@ -2251,6 +2266,7 @@ dissect_resource_outage_cause(tvbuff_t *cause_tvb, packet_info *pinfo, proto_tre
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_delete_source_address_cause(tvbuff_t *cause_tvb, packet_info *pinfo, proto_tree *cause_tree, proto_item *cause_item)
{
guint16 cause_info_length;
@@ -2266,6 +2282,7 @@ dissect_delete_source_address_cause(tvbuff_t *cause_tvb, packet_info *pinfo, pro
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_request_refused_cause(tvbuff_t *cause_tvb, packet_info *pinfo, proto_tree *cause_tree)
{
guint16 cause_info_length;
@@ -2339,6 +2356,7 @@ static const value_string cause_code_values[] = {
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_error_cause(tvbuff_t *cause_tvb, packet_info *pinfo, proto_tree *chunk_tree)
{
guint16 code, length, padding_length;
@@ -2356,6 +2374,7 @@ dissect_error_cause(tvbuff_t *cause_tvb, packet_info *pinfo, proto_tree *chunk_t
proto_tree_add_item(cause_tree, hf_cause_length, cause_tvb, CAUSE_LENGTH_OFFSET, CAUSE_LENGTH_LENGTH, ENC_BIG_ENDIAN);
/* XXX - add expert info if length is bogus? */
+ increment_dissection_depth(pinfo);
switch(code) {
case INVALID_STREAM_IDENTIFIER:
dissect_invalid_stream_identifier_cause(cause_tvb, cause_tree, cause_item);
@@ -2415,12 +2434,14 @@ dissect_error_cause(tvbuff_t *cause_tvb, packet_info *pinfo, proto_tree *chunk_t
dissect_unknown_cause(cause_tvb, cause_tree, cause_item);
break;
}
+ decrement_dissection_depth(pinfo);
if (padding_length > 0)
proto_tree_add_item(cause_tree, hf_cause_padding, cause_tvb, CAUSE_HEADER_OFFSET + length, padding_length, ENC_NA);
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_error_causes(tvbuff_t *causes_tvb, packet_info *pinfo, proto_tree *tree)
{
gint offset, length, total_length, remaining_length;
@@ -3587,6 +3608,7 @@ dissect_data_chunk(tvbuff_t *chunk_tvb,
INIT_CHUNK_INITIAL_TSN_LENGTH )
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_init_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_info *pinfo, proto_tree *chunk_tree, proto_item *chunk_item)
{
tvbuff_t *parameters_tvb;
@@ -3621,6 +3643,7 @@ dissect_init_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_info *pinfo
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_init_ack_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_info *pinfo, proto_tree *chunk_tree, proto_item *chunk_item)
{
tvbuff_t *parameters_tvb;
@@ -3998,6 +4021,7 @@ dissect_nr_sack_chunk(packet_info *pinfo, tvbuff_t *chunk_tvb, proto_tree *chunk
#define HEARTBEAT_CHUNK_INFO_OFFSET CHUNK_VALUE_OFFSET
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_heartbeat_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_info *pinfo, proto_tree *chunk_tree, proto_item *chunk_item)
{
tvbuff_t *parameter_tvb;
@@ -4015,6 +4039,7 @@ dissect_heartbeat_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_info *
#define HEARTBEAT_ACK_CHUNK_INFO_OFFSET CHUNK_VALUE_OFFSET
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_heartbeat_ack_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_info *pinfo, proto_tree *chunk_tree, proto_item *chunk_item)
{
tvbuff_t *parameter_tvb;
@@ -4033,6 +4058,7 @@ dissect_heartbeat_ack_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_in
#define SCTP_ABORT_CHUNK_T_BIT 0x01
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_abort_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_info *pinfo, proto_tree *chunk_tree, proto_item *flags_item)
{
tvbuff_t *causes_tvb;
@@ -4071,6 +4097,7 @@ dissect_shutdown_ack_chunk(tvbuff_t *chunk_tvb _U_)
#define ERROR_CAUSE_IND_CAUSES_OFFSET CHUNK_VALUE_OFFSET
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_error_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_info *pinfo, proto_tree *chunk_tree)
{
tvbuff_t *causes_tvb;
@@ -4231,6 +4258,7 @@ dissect_i_forward_tsn_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, proto_tre
#define RE_CONFIG_PARAMETERS_OFFSET CHUNK_HEADER_LENGTH
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_re_config_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_info *pinfo, proto_tree *chunk_tree, proto_item *chunk_item _U_)
{
tvbuff_t *parameters_tvb;
@@ -4264,6 +4292,7 @@ dissect_auth_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, proto_tree *chunk_
#define ASCONF_CHUNK_PARAMETERS_OFFSET (SEQUENCE_NUMBER_OFFSET + SCTP_SEQUENCE_NUMBER_LENGTH)
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_asconf_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_info *pinfo, proto_tree *chunk_tree, proto_item *chunk_item)
{
tvbuff_t *parameters_tvb;
@@ -4287,6 +4316,7 @@ dissect_asconf_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_info *pin
#define ASCONF_ACK_CHUNK_PARAMETERS_OFFSET (SEQUENCE_NUMBER_OFFSET + SCTP_SEQUENCE_NUMBER_LENGTH)
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_asconf_ack_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_info *pinfo, proto_tree *chunk_tree, proto_item *chunk_item)
{
tvbuff_t *parameters_tvb;
@@ -4344,6 +4374,7 @@ static const true_false_string sctp_pktdropk_t_bit_value = {
};
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_pktdrop_chunk(tvbuff_t *chunk_tvb, guint16 chunk_length, packet_info *pinfo, proto_tree *chunk_tree, proto_item *chunk_item, proto_item *flags_item)
{
tvbuff_t *data_field_tvb;
@@ -4427,6 +4458,7 @@ static const true_false_string sctp_chunk_bit_2_value = {
static gboolean
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_sctp_chunk(tvbuff_t *chunk_tvb,
packet_info *pinfo,
proto_tree *tree,
@@ -4492,6 +4524,7 @@ dissect_sctp_chunk(tvbuff_t *chunk_tvb,
*/
/* now dissect the chunk value */
+ increment_dissection_depth(pinfo);
switch(type) {
case SCTP_DATA_CHUNK_ID:
result = dissect_data_chunk(chunk_tvb, length, pinfo, tree, chunk_tree, chunk_item, flags_item, ha, FALSE);
@@ -4574,6 +4607,7 @@ dissect_sctp_chunk(tvbuff_t *chunk_tvb,
dissect_unknown_chunk(chunk_tvb, length, type, chunk_tree, chunk_item);
break;
}
+ decrement_dissection_depth(pinfo);
if (padding_length > 0)
proto_tree_add_item(chunk_tree, hf_chunk_padding, chunk_tvb, CHUNK_HEADER_OFFSET + length, padding_length, ENC_NA);
@@ -4585,6 +4619,7 @@ dissect_sctp_chunk(tvbuff_t *chunk_tvb,
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_sctp_chunks(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_item *sctp_item, proto_tree *sctp_tree, sctp_half_assoc_t *ha, gboolean encapsulated)
{
tvbuff_t *chunk_tvb;
@@ -4679,6 +4714,7 @@ dissect_sctp_chunks(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_i
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_sctp_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean encapsulated)
{
guint32 checksum = 0, calculated_crc32c = 0, calculated_adler32 = 0;
diff --git a/epan/dissectors/packet-simulcrypt.c b/epan/dissectors/packet-simulcrypt.c
index 5fac3a13..10eee43c 100644
--- a/epan/dissectors/packet-simulcrypt.c
+++ b/epan/dissectors/packet-simulcrypt.c
@@ -941,6 +941,7 @@ dissect_emmg_parameter_value (proto_tree *tree, tvbuff_t *tvb, packet_info *pinf
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_eis_parameter_value (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, guint32 offset,
guint16 plen, guint16 ptype, gchar *pvalue_char)
{
@@ -1082,7 +1083,7 @@ dissect_eis_parameter_value (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo
}
static void
-dissect_psig_parameter_value (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, guint32 offset,
+dissect_psig_parameter_value (proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, guint32 offset,
guint16 plen, guint16 ptype, gchar *pvalue_char)
{
proto_tree *simulcrypt_psig_table_period_pair_tree;
@@ -1090,6 +1091,7 @@ dissect_psig_parameter_value (proto_tree *tree, tvbuff_t *tvb, packet_info *pinf
proto_item *simulcrypt_item;
guint32 pvaluedec; /* parameter decimal value */
+ increment_dissection_depth(pinfo);
switch (ptype) {
case SIMULCRYPT_PSIG_PSIG_TYPE:
pvaluedec = tvb_get_guint8(tvb, offset);
@@ -1184,6 +1186,7 @@ dissect_psig_parameter_value (proto_tree *tree, tvbuff_t *tvb, packet_info *pinf
proto_tree_add_string(tree, hf_simulcrypt_parameter_value, tvb, offset, plen, pvalue_char);
break;
} /* end parameter type switch */
+ decrement_dissection_depth(pinfo);
}
/* This method dissects fully reassembled messages */
@@ -1264,6 +1267,7 @@ dissect_simulcrypt_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* this method is used to dissect TLV parameters */
/* can be used both from the main tree (simulcrypt_message_tree) and the subtrees (created from TLV items) */
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_simulcrypt_data(proto_tree *simulcrypt_tree, proto_item *simulcrypt_item, packet_info *pinfo _U_,
tvbuff_t *tvb, proto_tree *tree, int offset,
int container_data_length, guint16 iftype, gboolean is_subtree)
diff --git a/epan/dissectors/packet-sll.h b/epan/dissectors/packet-sll.h
index c34c7bb8..88b00724 100644
--- a/epan/dissectors/packet-sll.h
+++ b/epan/dissectors/packet-sll.h
@@ -22,6 +22,7 @@
#define LINUX_SLL_P_PPPHDLC 0x0007 /* PPP HDLC frames */
#define LINUX_SLL_P_CAN 0x000C /* Controller Area Network */
#define LINUX_SLL_P_CANFD 0x000D /* Controller Area Network flexible data rate */
+#define LINUX_SLL_P_CANXL 0x000E /* Controller Area Network etended length */
#define LINUX_SLL_P_IRDA_LAP 0x0017 /* IrDA Link Access Protocol */
#define LINUX_SLL_P_ISI 0x00F5 /* Intelligent Service Interface */
#define LINUX_SLL_P_IEEE802154 0x00f6 /* 802.15.4 on monitor inteface */
diff --git a/epan/dissectors/packet-slsk.c b/epan/dissectors/packet-slsk.c
index 2ee9a925..ab648bcb 100644
--- a/epan/dissectors/packet-slsk.c
+++ b/epan/dissectors/packet-slsk.c
@@ -245,7 +245,8 @@ static const char* connection_type(char con_type[]) {
return "Unknown";
}
-static gboolean check_slsk_format(tvbuff_t *tvb, int offset, const char format[]){
+// NOLINTNEXTLINE(misc-no-recursion)
+static gboolean check_slsk_format(tvbuff_t *tvb, packet_info *pinfo, int offset, const char format[]){
/*
* Returns TRUE if tvbuff beginning at offset matches a certain format
@@ -282,11 +283,14 @@ static gboolean check_slsk_format(tvbuff_t *tvb, int offset, const char format[]
return FALSE;
return TRUE;
}
- return check_slsk_format(tvb, offset, &format[1]);
+ increment_dissection_depth(pinfo);
+ gboolean valid = check_slsk_format(tvb, pinfo, offset, &format[1]);
+ decrement_dissection_depth(pinfo);
+ return valid;
}
-static const char* get_message_type(tvbuff_t *tvb) {
+static const char* get_message_type(tvbuff_t *tvb, packet_info *pinfo) {
/*
* Checks if the Message Code is known.
* If unknown checks if the Message Code is stored in a byte.
@@ -295,11 +299,11 @@ static const char* get_message_type(tvbuff_t *tvb) {
int msg_code = tvb_get_letohl(tvb, 4);
const gchar *message_type = try_val_to_str(msg_code, slsk_tcp_msgs);
if (message_type == NULL) {
- if (check_slsk_format(tvb, 4, "bisis"))
+ if (check_slsk_format(tvb, pinfo, 4, "bisis"))
message_type = "Distributed Search";
- else if (check_slsk_format(tvb, 4, "bssi"))
+ else if (check_slsk_format(tvb, pinfo, 4, "bssi"))
message_type = "Peer Init";
- else if (check_slsk_format(tvb, 4, "bi"))
+ else if (check_slsk_format(tvb, pinfo, 4, "bi"))
message_type = "Pierce Fw";
else
message_type = "Unknown";
@@ -342,7 +346,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
col_set_str(pinfo->cinfo, COL_INFO, "SoulSeek Message");
- col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", get_message_type(tvb));
+ col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", get_message_type(tvb, pinfo));
/* create display subtree for the protocol */
ti = proto_tree_add_item(tree, proto_slsk, tvb, 0, -1, ENC_NA);
@@ -357,7 +361,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
switch (msg_code) {
case 1:
- if (check_slsk_format(tvb, offset, "issi")) {
+ if (check_slsk_format(tvb, pinfo, offset, "issi")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Login (Code: %02d)", msg_code);
@@ -369,7 +373,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item(slsk_tree, hf_slsk_version, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
}
- else if (check_slsk_format(tvb, offset, "ibs") || check_slsk_format(tvb, offset, "ibsi")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "ibs") || check_slsk_format(tvb, pinfo, offset, "ibsi")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Login Reply (Code: %02d)", msg_code);
@@ -387,7 +391,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 2:
- if (check_slsk_format(tvb, offset, "ii")) {
+ if (check_slsk_format(tvb, pinfo, offset, "ii")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Set Wait Port (Code: %02d)", msg_code);
@@ -398,7 +402,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 3:
- if (check_slsk_format(tvb, offset, "isii")) {
+ if (check_slsk_format(tvb, pinfo, offset, "isii")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Get Peer Address Reply (Code: %02d)", msg_code);
@@ -410,7 +414,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item(slsk_tree, hf_slsk_port, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
}
- else if (check_slsk_format(tvb, offset, "is")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "is")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Get Peer Address (Code: %02d)", msg_code);
@@ -421,7 +425,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 4:
- if (check_slsk_format(tvb, offset, "i")) {
+ if (check_slsk_format(tvb, pinfo, offset, "i")) {
/* Client-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Get Shared File List (Code: %02d)", msg_code);
@@ -430,7 +434,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 5:
- if (check_slsk_format(tvb, offset, "isb")) {
+ if (check_slsk_format(tvb, pinfo, offset, "isb")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"User Exists Reply (Code: %02d)", msg_code);
@@ -440,7 +444,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item(slsk_tree, hf_slsk_user_exists, tvb, offset, 1, ENC_NA);
offset += 1;
}
- else if (check_slsk_format(tvb, offset, "is")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "is")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"User Exists Request (Code: %02d)", msg_code);
@@ -448,7 +452,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item_ret_length(slsk_tree, hf_slsk_username, tvb, offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
offset += str_len;
}
- else if (check_slsk_format(tvb, offset, "i*")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "i*")) {
/* Client-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Shared File List (Code: %02d)", msg_code);
@@ -478,11 +482,11 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
add_new_data_source(pinfo, uncompr_tvb, "Uncompressed SoulSeek data");
uncompr_tvb_offset = 0;
- if (check_slsk_format(uncompr_tvb, uncompr_tvb_offset, "i*")) {
+ if (check_slsk_format(uncompr_tvb, pinfo, uncompr_tvb_offset, "i*")) {
proto_tree_add_item_ret_int(slsk_compr_packet_tree, hf_slsk_num_directories, uncompr_tvb, uncompr_tvb_offset, 4, ENC_LITTLE_ENDIAN, &j);
uncompr_tvb_offset += 4;
for (i = 0; i < j; i++) {
- if (check_slsk_format(uncompr_tvb, uncompr_tvb_offset, "si*")) {
+ if (check_slsk_format(uncompr_tvb, pinfo, uncompr_tvb_offset, "si*")) {
start_offset = uncompr_tvb_offset;
subtree = proto_tree_add_subtree_format(slsk_compr_packet_tree, uncompr_tvb, uncompr_tvb_offset, 1, ett_slsk_directory, &ti_subtree, "Directory #%d", i+1);
proto_tree_add_item_ret_length(subtree, hf_slsk_directory_name, uncompr_tvb, uncompr_tvb_offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
@@ -490,7 +494,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item_ret_int(subtree, hf_slsk_num_files, uncompr_tvb, uncompr_tvb_offset, 4, ENC_LITTLE_ENDIAN, &j2);
uncompr_tvb_offset += 4;
for (i2 = 0; i2 < j2; i2++) {
- if (check_slsk_format(uncompr_tvb, uncompr_tvb_offset, "bsiisi*")) {
+ if (check_slsk_format(uncompr_tvb, pinfo, uncompr_tvb_offset, "bsiisi*")) {
start_offset2 = uncompr_tvb_offset;
subtree2 = proto_tree_add_subtree_format(subtree, uncompr_tvb, uncompr_tvb_offset, 1, ett_slsk_file, &ti_subtree2, "File #%d", i2+1);
proto_tree_add_item(subtree2, hf_slsk_file_code, uncompr_tvb, uncompr_tvb_offset, 1, ENC_NA);
@@ -506,7 +510,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item_ret_int(subtree2, hf_slsk_file_num_attributes, uncompr_tvb, uncompr_tvb_offset, 4, ENC_LITTLE_ENDIAN, &j3);
uncompr_tvb_offset += 4;
for (i3 = 0; i3 < j3; i3++) {
- if (check_slsk_format(uncompr_tvb, uncompr_tvb_offset, "ii*")) {
+ if (check_slsk_format(uncompr_tvb, pinfo, uncompr_tvb_offset, "ii*")) {
subtree3 = proto_tree_add_subtree_format(subtree2, uncompr_tvb, uncompr_tvb_offset, 8, ett_slsk_file_attribute, NULL, "Attribute #%d", i3+1);
proto_tree_add_item(subtree3, hf_slsk_file_attribute_type, uncompr_tvb, uncompr_tvb_offset, 4, ENC_LITTLE_ENDIAN);
uncompr_tvb_offset += 4;
@@ -539,7 +543,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 7:
- if (check_slsk_format(tvb, offset, "isi")) {
+ if (check_slsk_format(tvb, pinfo, offset, "isi")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Get User Status Reply (Code: %02d)", msg_code);
@@ -549,7 +553,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item(slsk_tree, hf_slsk_status_code, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
}
- else if (check_slsk_format(tvb, offset, "is")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "is")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Get User Status (Code: %02d)", msg_code);
@@ -560,7 +564,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 9:
- if (check_slsk_format(tvb, offset, "i*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "i*")) {
/* Client-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"File Search Result (Code: %02d)", msg_code);
@@ -592,7 +596,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
add_new_data_source(pinfo, uncompr_tvb, "Uncompressed SoulSeek data");
uncompr_tvb_offset = 0;
- if (check_slsk_format(uncompr_tvb, uncompr_tvb_offset, "sii*")) {
+ if (check_slsk_format(uncompr_tvb, pinfo, uncompr_tvb_offset, "sii*")) {
proto_tree_add_item_ret_length(slsk_compr_packet_tree, hf_slsk_username, uncompr_tvb, uncompr_tvb_offset, 4, ENC_ASCII|ENC_NA, &str_len);
uncompr_tvb_offset += str_len;
proto_tree_add_item(slsk_compr_packet_tree, hf_slsk_token, uncompr_tvb, uncompr_tvb_offset, 4, ENC_LITTLE_ENDIAN);
@@ -600,7 +604,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item_ret_int(slsk_compr_packet_tree, hf_slsk_num_files, uncompr_tvb, uncompr_tvb_offset, 4, ENC_LITTLE_ENDIAN, &j);
uncompr_tvb_offset += 4;
for (i = 0; i < j; i++) {
- if (check_slsk_format(uncompr_tvb, uncompr_tvb_offset, "bsiisi*")) {
+ if (check_slsk_format(uncompr_tvb, pinfo, uncompr_tvb_offset, "bsiisi*")) {
start_offset2 = uncompr_tvb_offset;
subtree2 = proto_tree_add_subtree_format(slsk_compr_packet_tree, uncompr_tvb, uncompr_tvb_offset, 1, ett_slsk_file, &ti_subtree2, "File #%d", i+1);
proto_tree_add_item(subtree2, hf_slsk_file_code, uncompr_tvb, uncompr_tvb_offset, 1, ENC_NA);
@@ -616,7 +620,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item_ret_int(subtree2, hf_slsk_file_num_attributes, uncompr_tvb, uncompr_tvb_offset, 4, ENC_LITTLE_ENDIAN, &j2);
uncompr_tvb_offset += 4;
for (i2 = 0; i2 < j2; i2++) {
- if (check_slsk_format(uncompr_tvb, uncompr_tvb_offset, "ii*")) {
+ if (check_slsk_format(uncompr_tvb, pinfo, uncompr_tvb_offset, "ii*")) {
subtree3 = proto_tree_add_subtree_format(subtree2, uncompr_tvb, uncompr_tvb_offset, 8, ett_slsk_file_attribute, NULL, "Attribute #%d", i2+1);
proto_tree_add_item(subtree3, hf_slsk_file_attribute_type, uncompr_tvb, uncompr_tvb_offset, 4, ENC_LITTLE_ENDIAN);
uncompr_tvb_offset += 4;
@@ -650,7 +654,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 13:
- if (check_slsk_format(tvb, offset, "isss")) {
+ if (check_slsk_format(tvb, pinfo, offset, "isss")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Say ChatRoom (Code: %02d)", msg_code);
@@ -662,7 +666,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item_ret_length(slsk_tree, hf_slsk_chat_message, tvb, offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
offset += str_len;
}
- else if (check_slsk_format(tvb, offset, "iss")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "iss")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Say ChatRoom (Code: %02d)", msg_code);
@@ -675,7 +679,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 14:
- if (check_slsk_format(tvb, offset, "is")) {
+ if (check_slsk_format(tvb, pinfo, offset, "is")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Join/Add Room (Code: %02d)", msg_code);
@@ -683,7 +687,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item_ret_length(slsk_tree, hf_slsk_room, tvb, offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
offset += str_len;
}
- else if (check_slsk_format(tvb, offset, "isi*")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "isi*")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Join Room User List (Code: %02d)", msg_code);
@@ -695,20 +699,20 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (j > tvb_reported_length_remaining(tvb, offset))
break;
for (i = 0; i < j; i++) {
- if (check_slsk_format(tvb, offset, "s*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "s*")) {
proto_tree_add_item_ret_length(slsk_tree, hf_slsk_user, tvb, offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
offset += str_len;
} else {
break; /* invalid format */
}
}
- if (check_slsk_format(tvb, offset, "i*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "i*")) {
proto_tree_add_item_ret_int(slsk_tree, hf_slsk_users_in_room, tvb, offset, 4, ENC_LITTLE_ENDIAN, &j);
offset += 4;
if (j > tvb_reported_length_remaining(tvb, offset))
break;
for (i = 0; i < j; i++) {
- if (check_slsk_format(tvb, offset, "i*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "i*")) {
proto_tree_add_item(slsk_tree, hf_slsk_status_code, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
} else {
@@ -716,13 +720,13 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
}
}
- if (check_slsk_format(tvb, offset, "i*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "i*")) {
proto_tree_add_item_ret_int(slsk_tree, hf_slsk_users_in_room, tvb, offset, 4, ENC_LITTLE_ENDIAN, &j);
offset += 4;
if (j > tvb_reported_length_remaining(tvb, offset))
break;
for (i = 0; i < j; i++) {
- if (check_slsk_format(tvb, offset, "iiiii*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "iiiii*")) {
subtree = proto_tree_add_subtree_format(slsk_tree, tvb, offset, 20, ett_slsk_user, NULL, "User #%d", i+1);
proto_tree_add_item(subtree, hf_slsk_average_speed, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
@@ -739,13 +743,13 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
}
}
- if (check_slsk_format(tvb, offset, "i*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "i*")) {
proto_tree_add_item_ret_int(slsk_tree, hf_slsk_num_slotsfull_records, tvb, offset, 4, ENC_LITTLE_ENDIAN, &j);
offset += 4;
if (j > tvb_reported_length_remaining(tvb, offset))
break;
for (i = 0; i < j; i++) {
- if (check_slsk_format(tvb, offset, "i*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "i*")) {
subtree = proto_tree_add_subtree_format(slsk_tree, tvb, offset, 4, ett_slsk_user, NULL, "User #%d", i+1);
proto_tree_add_item(subtree, hf_slsk_slotsfull, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
@@ -758,7 +762,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 15:
- if (check_slsk_format(tvb, offset, "is")) {
+ if (check_slsk_format(tvb, pinfo, offset, "is")) {
/* Client-to-Server & Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Leave Room (Code: %02d)", msg_code);
@@ -766,7 +770,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item_ret_length(slsk_tree, hf_slsk_room, tvb, offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
offset += str_len;
}
- else if (check_slsk_format(tvb, offset, "i")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "i")) {
/* Client-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"User Info Request (Code: %02d)", msg_code);
@@ -775,7 +779,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 16:
- if (check_slsk_format(tvb, offset, "issiiiiiii")) {
+ if (check_slsk_format(tvb, pinfo, offset, "issiiiiiii")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"User Joined Room (Code: %02d)", msg_code);
@@ -799,7 +803,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item(slsk_tree, hf_slsk_slotsfull, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
}
- else if (check_slsk_format(tvb, offset, "isbiib") || check_slsk_format(tvb, offset, "isbsiib")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "isbiib") || check_slsk_format(tvb, pinfo, offset, "isbsiib")) {
/* Client-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"User Info Reply (Code: %02d)", msg_code);
@@ -822,7 +826,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 17:
- if (check_slsk_format(tvb, offset, "iss")) {
+ if (check_slsk_format(tvb, pinfo, offset, "iss")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"User Left Room (Code: %02d)", msg_code);
@@ -835,7 +839,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 18:
- if (check_slsk_format(tvb, offset, "iiss")) {
+ if (check_slsk_format(tvb, pinfo, offset, "iiss")) {
/* Client-to-Server */
guint32 len;
@@ -853,7 +857,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
format_text(pinfo->pool, str, len));
offset += 4+len;
}
- else if (check_slsk_format(tvb, offset, "issiii")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "issiii")) {
/* Server-to-Client */
guint32 len;
@@ -878,7 +882,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 22:
- if (check_slsk_format(tvb, offset, "iss")) {
+ if (check_slsk_format(tvb, pinfo, offset, "iss")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Message User Send (Code: %02d)", msg_code);
@@ -888,7 +892,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item_ret_length(slsk_tree, hf_slsk_chat_message, tvb, offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
offset += str_len;
}
- else if (check_slsk_format(tvb, offset, "iiiss")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "iiiss")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Message User Receive (Code: %02d)", msg_code);
@@ -905,7 +909,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 23:
- if (check_slsk_format(tvb, offset, "ii")) {
+ if (check_slsk_format(tvb, pinfo, offset, "ii")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Message User Receive Ack (Code: %02d)", msg_code);
@@ -916,7 +920,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 26:
- if (check_slsk_format(tvb, offset, "iis")) {
+ if (check_slsk_format(tvb, pinfo, offset, "iis")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"File Search (Code: %02d)", msg_code);
@@ -929,7 +933,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 28:
- if (check_slsk_format(tvb, offset, "ii")) {
+ if (check_slsk_format(tvb, pinfo, offset, "ii")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Set Status (Code: %02d)", msg_code);
@@ -940,7 +944,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 32:
- if (check_slsk_format(tvb, offset, "i")) {
+ if (check_slsk_format(tvb, pinfo, offset, "i")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Ping (Code: %02d)", msg_code);
@@ -949,7 +953,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 34:
- if (check_slsk_format(tvb, offset, "isi")) {
+ if (check_slsk_format(tvb, pinfo, offset, "isi")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Update Upload Speed (Code: %02d)", msg_code);
@@ -962,7 +966,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 35:
- if (check_slsk_format(tvb, offset, "iii")) {
+ if (check_slsk_format(tvb, pinfo, offset, "iii")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Shared Files & Folders (Code: %02d)", msg_code);
@@ -975,7 +979,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 36:
- if (check_slsk_format(tvb, offset, "isiiiii")) {
+ if (check_slsk_format(tvb, pinfo, offset, "isiiiii")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Get User Stats Reply (Code: %02d)", msg_code);
@@ -993,7 +997,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item(slsk_tree, hf_slsk_directories, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
}
- else if (check_slsk_format(tvb, offset, "is")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "is")) {
/* Client-to-Client */
/* Client-to-Server: send after login successful */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
@@ -1002,7 +1006,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item_ret_length(slsk_tree, hf_slsk_username, tvb, offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
offset += str_len;
}
- else if (check_slsk_format(tvb, offset, "iis")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "iis")) {
/* Client-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Folder Contents Request (Code: %02d)", msg_code);
@@ -1015,7 +1019,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 37:
- if (check_slsk_format(tvb, offset, "i*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "i*")) {
/* Client-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Folder Contents Response (Code: %02d)", msg_code);
@@ -1045,7 +1049,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
add_new_data_source(pinfo, uncompr_tvb, "Uncompressed SoulSeek data");
uncompr_tvb_offset = 0;
- if (check_slsk_format(uncompr_tvb, uncompr_tvb_offset, "isi*")) {
+ if (check_slsk_format(uncompr_tvb, pinfo, uncompr_tvb_offset, "isi*")) {
guint32 len;
proto_tree_add_item(slsk_compr_packet_tree, hf_slsk_token, uncompr_tvb, uncompr_tvb_offset, 4, ENC_LITTLE_ENDIAN);
@@ -1056,7 +1060,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item_ret_int(slsk_compr_packet_tree, hf_slsk_num_directories, uncompr_tvb, uncompr_tvb_offset, 4, ENC_LITTLE_ENDIAN, &j);
uncompr_tvb_offset += 4;
for (i = 0; i < j; i++) {
- if (check_slsk_format(uncompr_tvb, uncompr_tvb_offset, "si*")) {
+ if (check_slsk_format(uncompr_tvb, pinfo, uncompr_tvb_offset, "si*")) {
start_offset = uncompr_tvb_offset;
subtree = proto_tree_add_subtree_format(slsk_compr_packet_tree, uncompr_tvb, uncompr_tvb_offset, 1, ett_slsk_directory, &ti_subtree, "Directory #%d", i+1);
proto_tree_add_item_ret_length(subtree, hf_slsk_directory_name, uncompr_tvb, uncompr_tvb_offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
@@ -1064,7 +1068,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item_ret_int(subtree, hf_slsk_num_files, uncompr_tvb, uncompr_tvb_offset, 4, ENC_LITTLE_ENDIAN, &j2);
uncompr_tvb_offset += 4;
for (i2 = 0; i2 < j2; i2++) {
- if (check_slsk_format(uncompr_tvb, uncompr_tvb_offset, "bsiisi*")) {
+ if (check_slsk_format(uncompr_tvb, pinfo, uncompr_tvb_offset, "bsiisi*")) {
start_offset2 = uncompr_tvb_offset;
subtree2 = proto_tree_add_subtree_format(subtree, uncompr_tvb, uncompr_tvb_offset, 1, ett_slsk_file, &ti_subtree2, "File #%d", i2+1);
proto_tree_add_item(subtree2, hf_slsk_file_code, uncompr_tvb, uncompr_tvb_offset, 1, ENC_NA);
@@ -1080,7 +1084,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item_ret_int(subtree2, hf_slsk_file_num_attributes, uncompr_tvb, uncompr_tvb_offset, 4, ENC_LITTLE_ENDIAN, &j3);
uncompr_tvb_offset += 4;
for (i3 = 0; i3 < j3; i3++) {
- if (check_slsk_format(uncompr_tvb, uncompr_tvb_offset, "ii*")) {
+ if (check_slsk_format(uncompr_tvb, pinfo, uncompr_tvb_offset, "ii*")) {
subtree3 = proto_tree_add_subtree_format(subtree2, uncompr_tvb, uncompr_tvb_offset, 8, ett_slsk_file_attribute, NULL, "Attribute #%d", i3+1);
proto_tree_add_item(subtree3, hf_slsk_file_attribute_type, uncompr_tvb, uncompr_tvb_offset, 4, ENC_LITTLE_ENDIAN);
uncompr_tvb_offset += 4;
@@ -1113,7 +1117,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 40:
- if (check_slsk_format(tvb, offset, "isi")) {
+ if (check_slsk_format(tvb, pinfo, offset, "isi")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Queued Downloads (Code: %02d)", msg_code);
@@ -1123,7 +1127,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item(slsk_tree, hf_slsk_slotsfull, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
}
- else if (check_slsk_format(tvb, offset, "iiis") || check_slsk_format(tvb, offset, "iiisii")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "iiis") || check_slsk_format(tvb, pinfo, offset, "iiisii")) {
/* Client-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Transfer Request (Code: %02d)", msg_code);
@@ -1145,7 +1149,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 41:
- if (check_slsk_format(tvb, offset, "iibs") || check_slsk_format(tvb, offset, "iibii") || check_slsk_format(tvb, offset, "iib")) {
+ if (check_slsk_format(tvb, pinfo, offset, "iibs") || check_slsk_format(tvb, pinfo, offset, "iibii") || check_slsk_format(tvb, pinfo, offset, "iib")) {
/* Client-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Transfer Response (Code: %02d)", msg_code);
@@ -1170,7 +1174,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 42:
- if (check_slsk_format(tvb, offset, "is")) {
+ if (check_slsk_format(tvb, pinfo, offset, "is")) {
/* Client-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Placehold Upload (Code: %02d)", msg_code);
@@ -1181,7 +1185,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 43:
- if (check_slsk_format(tvb, offset, "is")) {
+ if (check_slsk_format(tvb, pinfo, offset, "is")) {
/* Client-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Queue Upload (Code: %02d)", msg_code);
@@ -1192,7 +1196,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 44:
- if (check_slsk_format(tvb, offset, "isi")) {
+ if (check_slsk_format(tvb, pinfo, offset, "isi")) {
/* Client-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Place In Queue (Code: %02d)", msg_code);
@@ -1205,7 +1209,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 46:
- if (check_slsk_format(tvb, offset, "is")) {
+ if (check_slsk_format(tvb, pinfo, offset, "is")) {
/* Client-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Upload Failed (Code: %02d)", msg_code);
@@ -1216,7 +1220,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 50:
- if (check_slsk_format(tvb, offset, "is")) {
+ if (check_slsk_format(tvb, pinfo, offset, "is")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Make Own Recommendation (Code: %02d)", msg_code);
@@ -1224,7 +1228,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item_ret_length(slsk_tree, hf_slsk_recommendation, tvb, offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
offset += str_len;
}
- else if (check_slsk_format(tvb, offset, "isi")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "isi")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Remove Own Recommendation (Code: %02d)", msg_code);
@@ -1234,7 +1238,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item(slsk_tree, hf_slsk_ranking, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
}
- else if (check_slsk_format(tvb, offset, "iss")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "iss")) {
/* Client-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Queue Failed (Code: %02d)", msg_code);
@@ -1247,7 +1251,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 51:
- if (check_slsk_format(tvb, offset, "is")) {
+ if (check_slsk_format(tvb, pinfo, offset, "is")) {
/* Client-to-Server: "Add Things I like" */
/* Client-to-Client: "Place In Queue Request" */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
@@ -1259,7 +1263,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 52:
- if (check_slsk_format(tvb, offset, "is")) {
+ if (check_slsk_format(tvb, pinfo, offset, "is")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Remove Things I like (Code: %02d)", msg_code);
@@ -1270,13 +1274,13 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 54:
- if (check_slsk_format(tvb, offset, "i")) {
+ if (check_slsk_format(tvb, pinfo, offset, "i")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Get Recommendations (Code: %02d)", msg_code);
offset += 4;
}
- else if (check_slsk_format(tvb, offset, "ii*")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "ii*")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Get Recommendations Reply (Code: %02d)", msg_code);
@@ -1286,7 +1290,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (j > tvb_reported_length_remaining(tvb, offset))
break;
for (i = 0; i < j; i++) {
- if (check_slsk_format(tvb, offset, "si*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "si*")) {
start_offset = offset;
subtree = proto_tree_add_subtree_format(slsk_tree, tvb, offset, 1, ett_slsk_recommendation, &ti_subtree, "Recommendation #%d", i+1);
proto_tree_add_item_ret_length(subtree, hf_slsk_recommendation, tvb, offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
@@ -1302,7 +1306,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 55:
- if (check_slsk_format(tvb, offset, "i")) {
+ if (check_slsk_format(tvb, pinfo, offset, "i")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Type 55 (Code: %02d)", msg_code);
@@ -1311,13 +1315,13 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 56:
- if (check_slsk_format(tvb, offset, "i")) {
+ if (check_slsk_format(tvb, pinfo, offset, "i")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Get Global Rankings (Code: %02d)", msg_code);
offset += 4;
}
- else if (check_slsk_format(tvb, offset, "ii*")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "ii*")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Get Global Rankings Reply (Code: %02d)", msg_code);
@@ -1327,7 +1331,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (j > tvb_reported_length_remaining(tvb, offset))
break;
for (i = 0; i < j; i++) {
- if (check_slsk_format(tvb, offset, "si*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "si*")) {
start_offset = offset;
subtree = proto_tree_add_subtree_format(slsk_tree, tvb, offset, 1, ett_slsk_recommendation, &ti_subtree, "Recommendation #%d", i+1);
proto_tree_add_item_ret_length(subtree, hf_slsk_recommendation, tvb, offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
@@ -1343,7 +1347,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 57:
- if (check_slsk_format(tvb, offset, "is")) {
+ if (check_slsk_format(tvb, pinfo, offset, "is")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Get User Recommendations (Code: %02d)", msg_code);
@@ -1351,7 +1355,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item_ret_length(slsk_tree, hf_slsk_username, tvb, offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
offset += str_len;
}
- else if (check_slsk_format(tvb, offset, "isi*")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "isi*")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Get User Recommendations Reply (Code: %02d)", msg_code);
@@ -1363,7 +1367,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (j > tvb_reported_length_remaining(tvb, offset))
break;
for (i = 0; i < j; i++) {
- if (check_slsk_format(tvb, offset, "s*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "s*")) {
start_offset = offset;
subtree = proto_tree_add_subtree_format(slsk_tree, tvb, offset, 1, ett_slsk_recommendation, &ti_subtree, "Recommendation #%d", i+1);
proto_tree_add_item_ret_length(subtree, hf_slsk_recommendation, tvb, offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
@@ -1377,7 +1381,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 58:
- if (check_slsk_format(tvb, offset, "isi*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "isi*")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Admin Command (Code: %02d)", msg_code);
@@ -1389,7 +1393,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (j > tvb_reported_length_remaining(tvb, offset))
break;
for (i = 0; i < j; i++) {
- if (check_slsk_format(tvb, offset, "s*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "s*")) {
start_offset = offset;
subtree = proto_tree_add_subtree_format(slsk_tree, tvb, offset, 1, ett_slsk_string, &ti_subtree, "String #%d", i+1);
proto_tree_add_item_ret_length(subtree, hf_slsk_string, tvb, offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
@@ -1403,7 +1407,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 60:
- if (check_slsk_format(tvb, offset, "isii")) {
+ if (check_slsk_format(tvb, pinfo, offset, "isii")) {
/* Client-to-Server & Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Place In Line Response (Code: %02d)", msg_code);
@@ -1418,7 +1422,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 62:
- if (check_slsk_format(tvb, offset, "is")) {
+ if (check_slsk_format(tvb, pinfo, offset, "is")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Room Added (Code: %02d)", msg_code);
@@ -1429,7 +1433,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 63:
- if (check_slsk_format(tvb, offset, "is")) {
+ if (check_slsk_format(tvb, pinfo, offset, "is")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Room Removed (Code: %02d)", msg_code);
@@ -1440,13 +1444,13 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 64:
- if (check_slsk_format(tvb, offset, "i")) {
+ if (check_slsk_format(tvb, pinfo, offset, "i")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Room List Request (Code: %02d)", msg_code);
offset += 4;
}
- else if (check_slsk_format(tvb, offset, "ii*")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "ii*")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Room List (Code: %02d)", msg_code);
@@ -1456,7 +1460,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (j > tvb_reported_length_remaining(tvb, offset))
break;
for (i = 0; i < j; i++) {
- if (check_slsk_format(tvb, offset, "s*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "s*")) {
start_offset = offset;
subtree = proto_tree_add_subtree_format(slsk_tree, tvb, offset, 1, ett_slsk_room, &ti_subtree, "Room #%d", i+1);
proto_tree_add_item_ret_length(subtree, hf_slsk_room, tvb, offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
@@ -1466,11 +1470,11 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break; /* invalid format */
}
}
- if (check_slsk_format(tvb, offset, "i*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "i*")) {
proto_tree_add_item_ret_int(slsk_tree, hf_slsk_users_in_room, tvb, offset, 4, ENC_LITTLE_ENDIAN, &j);
offset += 4;
for (i = 0; i < j; i++) {
- if (check_slsk_format(tvb, offset, "i*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "i*")) {
subtree = proto_tree_add_subtree_format(slsk_tree, tvb, offset, 4, ett_slsk_room, &ti_subtree, "Room #%d", i+1);
proto_tree_add_item(subtree, hf_slsk_users_in_room, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
@@ -1483,7 +1487,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 65:
- if (check_slsk_format(tvb, offset, "isissiii")) {
+ if (check_slsk_format(tvb, pinfo, offset, "isissiii")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Exact File Search (Code: %02d)", msg_code);
@@ -1499,7 +1503,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item(slsk_tree, hf_slsk_bytes, tvb, offset, 16, ENC_NA);
offset += 12;
}
- else if (check_slsk_format(tvb, offset, "iissiiib")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "iissiiib")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Exact File Search (Code: %02d)", msg_code);
@@ -1516,7 +1520,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 66:
- if (check_slsk_format(tvb, offset, "is")) {
+ if (check_slsk_format(tvb, pinfo, offset, "is")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Admin Message (Code: %02d)", msg_code);
@@ -1527,13 +1531,13 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 67:
- if (check_slsk_format(tvb, offset, "i")) {
+ if (check_slsk_format(tvb, pinfo, offset, "i")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Global User List Request (Code: %02d)", msg_code);
offset += 4;
}
- else if (check_slsk_format(tvb, offset, "isi*")) { /* same as case 14 */
+ else if (check_slsk_format(tvb, pinfo, offset, "isi*")) { /* same as case 14 */
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Global User List (Code: %02d)", msg_code);
@@ -1545,18 +1549,18 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (j > tvb_reported_length_remaining(tvb, offset))
break;
for (i = 0; i < j; i++) {
- if (check_slsk_format(tvb, offset, "s*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "s*")) {
proto_tree_add_item_ret_length(slsk_tree, hf_slsk_user, tvb, offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
offset += str_len;
} else {
break; /* invalid format */
}
}
- if (check_slsk_format(tvb, offset, "i*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "i*")) {
proto_tree_add_item_ret_int(slsk_tree, hf_slsk_users_in_room, tvb, offset, 4, ENC_LITTLE_ENDIAN, &j);
offset += 4;
for (i = 0; i < j; i++) {
- if (check_slsk_format(tvb, offset, "i*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "i*")) {
proto_tree_add_item(slsk_tree, hf_slsk_status_code, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
} else {
@@ -1564,13 +1568,13 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
}
}
- if (check_slsk_format(tvb, offset, "i*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "i*")) {
proto_tree_add_item_ret_int(slsk_tree, hf_slsk_users_in_room, tvb, offset, 4, ENC_LITTLE_ENDIAN, &j);
offset += 4;
if (j > tvb_reported_length_remaining(tvb, offset))
break;
for (i = 0; i < j; i++) {
- if (check_slsk_format(tvb, offset, "iiiii*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "iiiii*")) {
subtree = proto_tree_add_subtree_format(slsk_tree, tvb, offset, 20, ett_slsk_user, NULL, "User #%d", i+1);
proto_tree_add_item(subtree, hf_slsk_average_speed, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
@@ -1587,13 +1591,13 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
}
}
- if (check_slsk_format(tvb, offset, "i*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "i*")) {
proto_tree_add_item_ret_int(slsk_tree, hf_slsk_num_slotsfull_records, tvb, offset, 4, ENC_LITTLE_ENDIAN, &j);
offset += 4;
if (j > tvb_reported_length_remaining(tvb, offset))
break;
for (i = 0; i < j; i++) {
- if (check_slsk_format(tvb, offset, "i*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "i*")) {
subtree = proto_tree_add_subtree_format(slsk_tree, tvb, offset, 4, ett_slsk_user, NULL, "User #%d", i+1);
proto_tree_add_item(subtree, hf_slsk_slotsfull, tvb, offset, 4, ENC_LITTLE_ENDIAN);
offset += 4;
@@ -1606,7 +1610,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 68:
- if (check_slsk_format(tvb, offset, "isiiiis")) {
+ if (check_slsk_format(tvb, pinfo, offset, "isiiiis")) {
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Tunneled Message (Code: %02d)", msg_code);
offset += 4;
@@ -1626,13 +1630,13 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 69:
- if (check_slsk_format(tvb, offset, "i")) {
+ if (check_slsk_format(tvb, pinfo, offset, "i")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Privileged User List Request (Code: %02d)", msg_code);
offset += 4;
}
- else if (check_slsk_format(tvb, offset, "ii*")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "ii*")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Privileged User List (Code: %02d)", msg_code);
@@ -1642,7 +1646,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (j > tvb_reported_length_remaining(tvb, offset))
break;
for (i = 0; i < j; i++) {
- if (check_slsk_format(tvb, offset, "s*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "s*")) {
proto_tree_add_item_ret_length(slsk_tree, hf_slsk_user, tvb, offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
offset += str_len;
} else {
@@ -1653,7 +1657,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 71:
- if (check_slsk_format(tvb, offset, "ib")) {
+ if (check_slsk_format(tvb, pinfo, offset, "ib")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Get Parent List (Code: %02d)", msg_code);
@@ -1664,7 +1668,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 73:
- if (check_slsk_format(tvb, offset, "ii")) {
+ if (check_slsk_format(tvb, pinfo, offset, "ii")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Type 73 (Code: %02d)", msg_code);
@@ -1675,7 +1679,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 83:
- if (check_slsk_format(tvb, offset, "ii")) {
+ if (check_slsk_format(tvb, pinfo, offset, "ii")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Parent Min Speed (Code: %02d)", msg_code);
@@ -1686,7 +1690,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 84:
- if (check_slsk_format(tvb, offset, "ii")) {
+ if (check_slsk_format(tvb, pinfo, offset, "ii")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Parent Speed Connection Ratio (Code: %02d)", msg_code);
@@ -1697,7 +1701,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 86:
- if (check_slsk_format(tvb, offset, "ii")) {
+ if (check_slsk_format(tvb, pinfo, offset, "ii")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Parent Inactivity Before Disconnect (Code: %02d)", msg_code);
@@ -1708,7 +1712,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 87:
- if (check_slsk_format(tvb, offset, "ii")) {
+ if (check_slsk_format(tvb, pinfo, offset, "ii")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Server Inactivity Before Disconnect (Code: %02d)", msg_code);
@@ -1719,7 +1723,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 88:
- if (check_slsk_format(tvb, offset, "ii")) {
+ if (check_slsk_format(tvb, pinfo, offset, "ii")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Nodes In Cache Before Disconnect (Code: %02d)", msg_code);
@@ -1730,7 +1734,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 90:
- if (check_slsk_format(tvb, offset, "ii")) {
+ if (check_slsk_format(tvb, pinfo, offset, "ii")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Seconds Before Ping Children (Code: %02d)", msg_code);
@@ -1741,7 +1745,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 91:
- if (check_slsk_format(tvb, offset, "is")) {
+ if (check_slsk_format(tvb, pinfo, offset, "is")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Add To Privileged (Code: %02d)", msg_code);
@@ -1752,13 +1756,13 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 92:
- if (check_slsk_format(tvb, offset, "i")) {
+ if (check_slsk_format(tvb, pinfo, offset, "i")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Check Privileges (Code: %02d)", msg_code);
offset += 4;
}
- else if (check_slsk_format(tvb, offset, "ii")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "ii")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Check Privileges Reply (Code: %02d)", msg_code);
@@ -1769,7 +1773,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 93:
- if (check_slsk_format(tvb, offset, "ibisis")) {
+ if (check_slsk_format(tvb, pinfo, offset, "ibisis")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Embedded Message (Code: %02d)", msg_code);
@@ -1792,7 +1796,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 100:
- if (check_slsk_format(tvb, offset, "ib")) {
+ if (check_slsk_format(tvb, pinfo, offset, "ib")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Become Parent (Code: %02d)", msg_code);
@@ -1803,7 +1807,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 102:
- if (check_slsk_format(tvb, offset, "ii*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "ii*")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Random Parent Addresses (Code: %02d)", msg_code);
@@ -1813,7 +1817,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (j > tvb_reported_length_remaining(tvb, offset))
break;
for (i = 0; i < j; i++) {
- if (check_slsk_format(tvb, offset, "sii*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "sii*")) {
proto_tree_add_item_ret_length(slsk_tree, hf_slsk_user, tvb, offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
offset += str_len;
@@ -1829,7 +1833,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 103:
- if (check_slsk_format(tvb, offset, "iis")) {
+ if (check_slsk_format(tvb, pinfo, offset, "iis")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Send Wishlist Entry (Code: %02d)", msg_code);
@@ -1842,7 +1846,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 104:
- if (check_slsk_format(tvb, offset, "ii")) {
+ if (check_slsk_format(tvb, pinfo, offset, "ii")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Type 104 (Code: %02d)", msg_code);
@@ -1853,13 +1857,13 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 110:
- if (check_slsk_format(tvb, offset, "i")) {
+ if (check_slsk_format(tvb, pinfo, offset, "i")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Get Similar Users (Code: %02d)", msg_code);
offset += 4;
}
- else if (check_slsk_format(tvb, offset, "ii*")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "ii*")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Get Similar Users Reply (Code: %02d)", msg_code);
@@ -1869,7 +1873,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (j > tvb_reported_length_remaining(tvb, offset))
break;
for (i = 0; i < j; i++) {
- if (check_slsk_format(tvb, offset, "si*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "si*")) {
start_offset = offset;
subtree = proto_tree_add_subtree_format(slsk_tree, tvb, offset, 4, ett_slsk_user, &ti_subtree, "User #%d", i+1);
proto_tree_add_item_ret_length(subtree, hf_slsk_user, tvb, offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
@@ -1885,7 +1889,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 111:
- if (check_slsk_format(tvb, offset, "is")) {
+ if (check_slsk_format(tvb, pinfo, offset, "is")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Get Recommendations for Item (Code: %02d)", msg_code);
@@ -1893,7 +1897,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item_ret_length(slsk_tree, hf_slsk_recommendation, tvb, offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
offset += str_len;
}
- else if (check_slsk_format(tvb, offset, "isi*")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "isi*")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Get Recommendations for Item Reply (Code: %02d)", msg_code);
@@ -1905,7 +1909,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (j > tvb_reported_length_remaining(tvb, offset))
break;
for (i = 0; i < j; i++) {
- if (check_slsk_format(tvb, offset, "si*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "si*")) {
start_offset = offset;
subtree = proto_tree_add_subtree_format(slsk_tree, tvb, offset, 1, ett_slsk_recommendation, &ti_subtree, "Recommendation #%d", i+1);
proto_tree_add_item_ret_length(subtree, hf_slsk_recommendation, tvb, offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
@@ -1921,7 +1925,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 112:
- if (check_slsk_format(tvb, offset, "is")) {
+ if (check_slsk_format(tvb, pinfo, offset, "is")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Get Similar Users for Item (Code: %02d)", msg_code);
@@ -1929,7 +1933,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item_ret_length(slsk_tree, hf_slsk_recommendation, tvb, offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
offset += str_len;
}
- else if (check_slsk_format(tvb, offset, "isi*")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "isi*")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Get Similar Users for Item Reply (Code: %02d)", msg_code);
@@ -1941,7 +1945,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (j > tvb_reported_length_remaining(tvb, offset))
break;
for (i = 0; i < j; i++) {
- if (check_slsk_format(tvb, offset, "s*")) {
+ if (check_slsk_format(tvb, pinfo, offset, "s*")) {
proto_tree_add_item_ret_length(slsk_tree, hf_slsk_username, tvb, offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
offset += str_len;
} else {
@@ -1952,7 +1956,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
case 1001:
- if (check_slsk_format(tvb, offset, "iis")) {
+ if (check_slsk_format(tvb, pinfo, offset, "iis")) {
/* Client-to-Server */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Can't Connect To Peer (Code: %02d)", msg_code);
@@ -1962,7 +1966,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item_ret_length(slsk_tree, hf_slsk_username, tvb, offset, 4, ENC_ASCII|ENC_LITTLE_ENDIAN, &str_len);
offset += str_len;
}
- else if (check_slsk_format(tvb, offset, "ii")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "ii")) {
/* Server-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 4, msg_code,
"Can't Connect To Peer (Code: %02d)", msg_code);
@@ -1973,7 +1977,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
default:
- if (check_slsk_format(tvb, offset, "bisis")) {
+ if (check_slsk_format(tvb, pinfo, offset, "bisis")) {
if ( tvb_get_guint8(tvb, offset) == 3 ){
/* Client-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 1, msg_code,
@@ -1989,7 +1993,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += str_len;
}
}
- else if (check_slsk_format(tvb, offset, "bssi")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "bssi")) {
if ( tvb_get_guint8(tvb, offset) == 1 ){
/* Client-to-Client */
guint32 len;
@@ -2009,7 +2013,7 @@ static int dissect_slsk_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset += 4;
}
}
- else if (check_slsk_format(tvb, offset, "bi")) {
+ else if (check_slsk_format(tvb, pinfo, offset, "bi")) {
if ( tvb_get_guint8(tvb, offset) == 0 ){
/* Client-to-Client */
proto_tree_add_uint_format_value(slsk_tree, hf_slsk_message_code, tvb, offset, 1, msg_code,
diff --git a/epan/dissectors/packet-smb2.c b/epan/dissectors/packet-smb2.c
index 6dbf0e41..55acb2a8 100644
--- a/epan/dissectors/packet-smb2.c
+++ b/epan/dissectors/packet-smb2.c
@@ -3843,6 +3843,7 @@ dissect_smb2_STATUS_STOPPED_ON_SYMLINK(tvbuff_t *tvb, packet_info *pinfo _U_, pr
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_smb2_error_context(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree, int offset, smb2_info_t *si _U_)
{
proto_tree *tree;
@@ -3871,6 +3872,7 @@ dissect_smb2_error_context(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *pa
* Assumes it is being called with a sub-tvb (dissects at offsets 0)
*/
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_smb2_error_data(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *parent_tree,
int error_context_count, int error_id,
smb2_info_t *si _U_)
@@ -3901,8 +3903,11 @@ dissect_smb2_error_data(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *paren
break;
}
} else {
- for (i = 0; i < error_context_count; i++)
+ increment_dissection_depth(pinfo);
+ for (i = 0; i < error_context_count; i++) {
offset += dissect_smb2_error_context(tvb, pinfo, tree, offset, si);
+ }
+ decrement_dissection_depth(pinfo);
}
}
@@ -7212,6 +7217,7 @@ dissect_windows_sockaddr_storage(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
#define NETWORK_INTERFACE_CAP_RDMA 0x00000002
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_smb2_NETWORK_INTERFACE_INFO(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree)
{
guint32 next_offset;
@@ -7293,7 +7299,9 @@ dissect_smb2_NETWORK_INTERFACE_INFO(tvbuff_t *tvb, packet_info *pinfo, proto_tre
next_tvb = tvb_new_subset_remaining(tvb, next_offset);
/* next extra info */
+ increment_dissection_depth(pinfo);
dissect_smb2_NETWORK_INTERFACE_INFO(next_tvb, pinfo, parent_tree);
+ decrement_dissection_depth(pinfo);
}
}
@@ -9102,6 +9110,7 @@ get_create_context_data_tag_dissectors(const char *tag)
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_smb2_create_extra_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, smb2_info_t *si)
{
offset_length_buffer_t tag_olb;
@@ -9177,7 +9186,9 @@ dissect_smb2_create_extra_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *pa
chain_tvb = tvb_new_subset_remaining(tvb, chain_offset);
/* next extra info */
+ increment_dissection_depth(pinfo);
dissect_smb2_create_extra_info(chain_tvb, pinfo, parent_tree, si);
+ decrement_dissection_depth(pinfo);
}
}
@@ -10958,6 +10969,7 @@ dissect_smb2_signature(packet_info *pinfo, tvbuff_t *tvb, int offset, proto_tree
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_smb2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, gboolean first_in_chain)
{
int msg_type;
@@ -11001,6 +11013,8 @@ dissect_smb2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, gboolea
break;
}
+ increment_dissection_depth(pinfo);
+
/* find which conversation we are part of and get the data for that
* conversation
*/
@@ -11315,6 +11329,7 @@ dissect_smb2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, gboolea
offset = dissect_smb2(next_tvb, pinfo, parent_tree, FALSE);
}
+ decrement_dissection_depth(pinfo);
return offset;
}
diff --git a/epan/dissectors/packet-sml.c b/epan/dissectors/packet-sml.c
index 8051f340..d1830ee4 100644
--- a/epan/dissectors/packet-sml.c
+++ b/epan/dissectors/packet-sml.c
@@ -1224,6 +1224,7 @@ static void TupleEntryTree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *procPa
proto_item_set_end(TupleEntry, tvb, *offset);
}
+// NOLINTNEXTLINE(misc-no-recursion)
static void child_tree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *insert_tree, guint *offset, guint *data, guint *length){
proto_item *parameterName;
proto_item *procParValue;
@@ -1388,7 +1389,9 @@ static void child_tree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *insert_tre
tree_Entry_list = proto_tree_add_subtree(child_list, tvb, *offset, -1, ett_sml_tree_Entry, &tree_Entry, "tree_Entry");
*offset+=1;
+ increment_dissection_depth(pinfo);
child_tree(tvb, pinfo,tree_Entry_list, offset, data, length);
+ decrement_dissection_depth(pinfo);
proto_item_set_end(tree_Entry, tvb, *offset);
proto_item_set_end(child, tvb, *offset);
@@ -1412,7 +1415,9 @@ static void child_tree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *insert_tre
}
*offset+=1;
+ increment_dissection_depth(pinfo);
child_tree(tvb, pinfo, tree_Entry_list, offset, data, length);
+ decrement_dissection_depth(pinfo);
proto_item_set_end(tree_Entry, tvb, *offset);
}
proto_item_set_end(child, tvb, *offset);
diff --git a/epan/dissectors/packet-sna.c b/epan/dissectors/packet-sna.c
index cdf6bfdb..c8a9dab8 100644
--- a/epan/dissectors/packet-sna.c
+++ b/epan/dissectors/packet-sna.c
@@ -2220,6 +2220,7 @@ dissect_rh(tvbuff_t *tvb, int offset, proto_tree *tree)
*/
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_control_05hpr(tvbuff_t *tvb, proto_tree *tree, int hpr,
enum parse parse)
{
@@ -2246,6 +2247,7 @@ dissect_control_05hpr(tvbuff_t *tvb, proto_tree *tree, int hpr,
len = tvb_get_guint8(tvb, offset+1);
}
if (len) {
+ // We recurse here, but we'll run out of packet before we run out of stack.
dissect_sna_control(tvb, offset, len, tree, hpr, parse);
pad = (len+3) & 0xfffc;
if (pad > len) {
@@ -2285,6 +2287,7 @@ dissect_control_0e(tvbuff_t *tvb, proto_tree *tree)
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_sna_control(tvbuff_t *parent_tvb, int offset, int control_len,
proto_tree *tree, int hpr, enum parse parse)
{
@@ -2351,6 +2354,7 @@ dissect_sna_control(tvbuff_t *parent_tvb, int offset, int control_len,
switch(key) {
case 0x05:
if (hpr)
+ // We recurse here, but we'll run out of packet before we run out of stack.
dissect_control_05hpr(tvb, sub_tree, hpr,
parse);
else
@@ -3447,8 +3451,7 @@ proto_register_sna(void)
};
module_t *sna_module;
- proto_sna = proto_register_protocol("Systems Network Architecture",
- "SNA", "sna");
+ proto_sna = proto_register_protocol("Systems Network Architecture", "SNA", "sna");
proto_register_field_array(proto_sna, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
sna_handle = register_dissector("sna", dissect_sna, proto_sna);
diff --git a/epan/dissectors/packet-snmp.c b/epan/dissectors/packet-snmp.c
index eac17af6..fcfc78dd 100644
--- a/epan/dissectors/packet-snmp.c
+++ b/epan/dissectors/packet-snmp.c
@@ -498,12 +498,9 @@ snmp_match_request_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
{
proto_item *it;
- // if it is a request
- if (srrp->request_frame_id == pinfo->fd->num)
+ // if it is the response
+ if (srrp->response_frame_id == pinfo->fd->num)
{
- it=proto_tree_add_uint(tree, hf_snmp_response_in, tvb, 0, 0, srrp->response_frame_id);
- proto_item_set_generated(it);
- } else {
nstime_t ns;
it=proto_tree_add_uint(tree, hf_snmp_response_to, tvb, 0, 0, srrp->request_frame_id);
proto_item_set_generated(it);
@@ -512,6 +509,9 @@ snmp_match_request_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_item_set_generated(it);
return srrp;
+ } else {
+ it=proto_tree_add_uint(tree, hf_snmp_response_in, tvb, 0, 0, srrp->response_frame_id);
+ proto_item_set_generated(it);
}
}
diff --git a/epan/dissectors/packet-snort-config.c b/epan/dissectors/packet-snort-config.c
index 9bd345b2..bea33e24 100644
--- a/epan/dissectors/packet-snort-config.c
+++ b/epan/dissectors/packet-snort-config.c
@@ -503,6 +503,7 @@ static gboolean delete_string_entry(gpointer key,
}
/* See if this is an include line, if it is open the file and call parse_config_file() */
+// NOLINTNEXTLINE(misc-no-recursion)
static gboolean parse_include_file(SnortConfig_t *snort_config, char *line, const char *config_directory, int recursion_level)
{
int length;
@@ -841,6 +842,7 @@ static gboolean delete_rule(gpointer key _U_,
/* Parse this file, adding details to snort_config. */
/* N.B. using recursion_level to limit stack depth. */
#define MAX_CONFIG_FILE_RECURSE_DEPTH 8
+// NOLINTNEXTLINE(misc-no-recursion)
static void parse_config_file(SnortConfig_t *snort_config, FILE *config_file_fd,
const char *filename, const char *dirname, int recursion_level)
{
diff --git a/epan/dissectors/packet-socketcan.c b/epan/dissectors/packet-socketcan.c
index 90cf2bf7..fc450d67 100644
--- a/epan/dissectors/packet-socketcan.c
+++ b/epan/dissectors/packet-socketcan.c
@@ -74,6 +74,13 @@ static int hf_can_err_trx_canl = -1;
static int hf_can_err_ctrl_specific = -1;
+static int hf_canxl_priority = -1;
+static int hf_canxl_vcid = -1;
+static int hf_canxl_secflag = -1;
+static int hf_canxl_sdu_type = -1;
+static int hf_canxl_len = -1;
+static int hf_canxl_acceptance_field = -1;
+
static expert_field ei_can_err_dlc_mismatch = EI_INIT;
static int hf_canfd_brsflag = -1;
@@ -81,9 +88,11 @@ static int hf_canfd_esiflag = -1;
static gint ett_can = -1;
static gint ett_can_fd = -1;
+static gint ett_can_xl = -1;
static int proto_can = -1;
static int proto_canfd = -1;
+static int proto_canxl = -1;
static gboolean byte_swap = FALSE;
static gboolean heuristic_first = FALSE;
@@ -103,11 +112,16 @@ static heur_dtbl_entry_t *heur_dtbl_entry;
#define CANFD_BRS 0x01 /* bit rate switch (second bitrate for payload data) */
#define CANFD_ESI 0x02 /* error state indicator of the transmitting node */
+#define CANXL_LEN_OFFSET 6
+#define CANXL_DATA_OFFSET 12
+
static dissector_table_t can_id_dissector_table = NULL;
static dissector_table_t can_extended_id_dissector_table = NULL;
static dissector_table_t subdissector_table = NULL;
+static dissector_table_t canxl_sdu_type_dissector_table = NULL;
static dissector_handle_t socketcan_classic_handle;
static dissector_handle_t socketcan_fd_handle;
+static dissector_handle_t socketcan_xl_handle;
static dissector_handle_t socketcan_bigendian_handle;
@@ -154,6 +168,19 @@ static const value_string can_err_trx_canl_vals[] = {
{ 0, NULL }
};
+static const value_string canxl_sdu_type_vals[] = {
+ { 0x00, "Reserved" },
+ { CANXL_SDU_TYPE_CONTENT_BASED_ADDRESSING, "Content-based Addressing" },
+ { 0x02, "Reserved for future use" },
+ { CANXL_SDU_TYPE_CLASSICAL_CAN_AND_CAN_FD_MAPPED_TUNNELING, "Classical CAN/CAN FD mapped tunneling" },
+ { CANXL_SDU_TYPE_IEEE_802_3_MAC_FRAME_TUNNELLING, "IEEE 802.3 (MAC frame) tunneling" },
+ { CANXL_SDU_TYPE_IEEE_802_3_MAC_FRAME_MAPPED_TUNNELING, "IEEE 802.3 (MAC frame) mapped tunneling" },
+ { CANXL_SDU_TYPE_CLASSICAL_CAN_MAPPED_TUNNELING, "Classical CAN mapped tunneling" },
+ { CANXL_SDU_TYPE_CAN_FD_MAPPED_TUNNELING, "CAN FD mapped tunneling" },
+ { 0xFF, "Reserved" },
+ { 0, NULL }
+};
+
/********* UATs *********/
/* Interface Config UAT */
@@ -486,45 +513,50 @@ socketcan_call_subdissectors(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
* 2) a given SocketCAN frame is known to contain a CAN FD
* packet based on information outside the SocketCAN header;
*
- * 3) we don't know whether the given SocketCAN frame is a
- * classic CAN packet or a CAN FD packet, and will have
- * to check the CANFD_FDF bit in the "FD flags" field of
- * the SocketCAN header to determine that.
+ * 3) a given SocketCAN frame is known to contain a CAN XL
+ * packet based on information outside the SocketCAN header;
+ *
+ * 4) we don't know whether the given SocketCAN frame is a
+ * classic CAN packet, a CAN FD packet, or a CAN XL packet,
+ * and will have to check the CANXL_XLF bit in the "Frame Length"
+ * field and the CANFD_FDF bit in the "FD flags" field of the
+ * SocketCAN header to determine that.
*/
typedef enum {
PACKET_TYPE_CAN,
PACKET_TYPE_CAN_FD,
+ PACKET_TYPE_CAN_XL,
PACKET_TYPE_UNKNOWN
} can_packet_type_t;
static int
-dissect_socketcan_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint encoding, can_packet_type_t can_packet_type) {
+dissect_socketcan_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint encoding, guint xl_encoding, can_packet_type_t can_packet_type) {
proto_tree *can_tree;
proto_item *ti;
guint8 frame_type;
can_info_t can_info;
- int * const *can_flags;
+ int * const *can_flags_id;
- static int * const can_std_flags[] = {
+ static int * const can_std_flags_id[] = {
&hf_can_infoent_std,
&hf_can_extflag,
&hf_can_rtrflag,
&hf_can_errflag,
NULL,
};
- static int * const can_ext_flags[] = {
+ static int * const can_ext_flags_id[] = {
&hf_can_infoent_ext,
&hf_can_extflag,
&hf_can_rtrflag,
&hf_can_errflag,
NULL,
};
- static int * const can_std_flags_fd[] = {
+ static int * const canfd_std_flags_id[] = {
&hf_can_infoent_std,
&hf_can_extflag,
NULL,
};
- static int * const can_ext_flags_fd[] = {
+ static int * const canfd_ext_flags_id[] = {
&hf_can_infoent_ext,
&hf_can_extflag,
NULL,
@@ -548,9 +580,15 @@ dissect_socketcan_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu
&hf_can_err_reserved,
NULL,
};
-
- can_info.id = tvb_get_guint32(tvb, 0, encoding);
- can_info.len = tvb_get_guint8(tvb, CAN_LEN_OFFSET);
+ static int * const canxl_prio_vcid_fields[] = {
+ &hf_canxl_priority,
+ &hf_canxl_vcid,
+ NULL,
+ };
+ static int * const canxl_flag_fields[] = {
+ &hf_canxl_secflag,
+ NULL,
+ };
/*
* If we weren't told the type of this frame, check
@@ -573,141 +611,236 @@ dissect_socketcan_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu
* the code is older code that didn't support CAN FD.
*/
if (can_packet_type == PACKET_TYPE_UNKNOWN) {
+ guint8 frame_length;
guint8 fd_flags;
- fd_flags = tvb_get_guint8(tvb, CANFD_FLAG_OFFSET);
-
- if ((fd_flags & CANFD_FDF) && ((fd_flags & ~(CANFD_BRS | CANFD_ESI | CANFD_FDF)) == 0) &&
- tvb_get_guint8(tvb, CANFD_FLAG_OFFSET + 1) == 0 &&
- tvb_get_guint8(tvb, CANFD_FLAG_OFFSET + 2) == 0) {
- can_packet_type = PACKET_TYPE_CAN_FD;
+ /*
+ * Check whether the frame has the CANXL_XLF flag set in what
+ * is in the location of the frame length field of a CAN classic
+ * or CAN FD frame; if so, then it's a CAN XL frame (and that
+ * field is the flags field of that frame).
+ */
+ frame_length = tvb_get_guint8(tvb, CAN_LEN_OFFSET);
+ if (frame_length & CANXL_XLF) {
+ can_packet_type = PACKET_TYPE_CAN_XL;
} else {
- can_packet_type = PACKET_TYPE_CAN;
+ /*
+ * This is a CAN classic or CAN FD frame.
+ * Check whether the flags field has the CANFD_FDF
+ * flag set, has no unknown flag bits set, and has
+ * no bits set in the two reserved fields. If so,
+ * it's a CAN FD frame; otherwise, it's either a
+ * CAN classic frame, or a frame where the CANFD_FDF
+ * flag is set but where that might just be because
+ * that field contains uninitialized junk rather
+ * than because it's a CAN FD frame, so we treat it
+ * as a CAN classic frame.
+ */
+ fd_flags = tvb_get_guint8(tvb, CANFD_FLAG_OFFSET);
+
+ if ((fd_flags & CANFD_FDF) &&
+ ((fd_flags & ~(CANFD_BRS | CANFD_ESI | CANFD_FDF)) == 0) &&
+ tvb_get_guint8(tvb, CANFD_FLAG_OFFSET + 1) == 0 &&
+ tvb_get_guint8(tvb, CANFD_FLAG_OFFSET + 2) == 0) {
+ can_packet_type = PACKET_TYPE_CAN_FD;
+ } else {
+ if (tvb_reported_length(tvb) == 72)
+ can_packet_type = PACKET_TYPE_CAN_FD;
+ else
+ can_packet_type = PACKET_TYPE_CAN;
+ }
}
}
- can_info.fd = (can_packet_type == PACKET_TYPE_CAN_FD);
can_info.bus_id = get_bus_id(pinfo);
- /* Error Message Frames are only encapsulated in Classic CAN frames */
- if (can_packet_type == PACKET_TYPE_CAN && (can_info.id & CAN_ERR_FLAG)) {
- frame_type = LINUX_CAN_ERR;
- can_flags = can_err_flags;
- } else if (can_info.id & CAN_EFF_FLAG) {
- frame_type = LINUX_CAN_EXT;
- can_info.id &= (CAN_EFF_MASK | CAN_FLAG_MASK);
- can_flags = (can_packet_type == PACKET_TYPE_CAN_FD) ? can_ext_flags_fd : can_ext_flags;
- } else {
- frame_type = LINUX_CAN_STD;
- can_info.id &= (CAN_SFF_MASK | CAN_FLAG_MASK);
- can_flags = (can_packet_type == PACKET_TYPE_CAN_FD) ? can_std_flags_fd : can_std_flags;
- }
+ if (can_packet_type == PACKET_TYPE_CAN_XL) {
+ can_info.fd = CAN_TYPE_CAN_XL;
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "CANXL");
+ col_clear(pinfo->cinfo, COL_INFO);
+
+ can_info.id = 0; /* XXX - is there an "ID" for XL frames? */
+
+ ti = proto_tree_add_item(tree, proto_can, tvb, 0, -1, ENC_NA);
+ proto_item_set_hidden(ti);
+ ti = proto_tree_add_item(tree, proto_canxl, tvb, 0, -1, ENC_NA);
+ can_tree = proto_item_add_subtree(ti, ett_can_xl);
+
+ guint32 proto_vcid;
+
+ /*
+ * The priority/VCID field is big-endian in LINKTYPE_CAN_SOCKETCAN
+ * captures, for historical reasons. It's host-endian in
+ * Linux cooked captures. This means we use the non-XL encoding.
+ */
+ proto_tree_add_bitmask_list(can_tree, tvb, 0, 4, canxl_prio_vcid_fields, encoding);
+ proto_vcid = tvb_get_guint32(tvb, 0, encoding);
+ col_add_fstr(pinfo->cinfo, COL_INFO, "Priority: %u (0x%03x), VCID: %u (0x%02X)", proto_vcid & 0x7FF, proto_vcid & 0x7FF, (proto_vcid >> 16) & 0xFF, (proto_vcid >> 16) & 0xFF);
+ proto_item_append_text(can_tree, ", Priority: %u (0x%03x), VCID: %u (0x%02X)", proto_vcid & 0x7FF, proto_vcid & 0x7FF, (proto_vcid >> 16) & 0xFF, (proto_vcid >> 16) & 0xFF);
+ proto_tree_add_bitmask_list(can_tree, tvb, 4, 1, canxl_flag_fields, xl_encoding);
+
+ socketcan_set_source_and_destination_columns(pinfo, &can_info);
+
+ guint32 sdu_type;
+
+ /*
+ * These fields are, if multi-byte, little-endian in
+ * LINKTYPE_CAN_SOCKETCAN captures, so use xl_encoding.
+ */
+ proto_tree_add_item_ret_uint(can_tree, hf_canxl_sdu_type, tvb, 5, 1, ENC_NA, &sdu_type);
+ proto_tree_add_item_ret_uint(can_tree, hf_canxl_len, tvb, CANXL_LEN_OFFSET, 2, xl_encoding, &can_info.len);
+ col_append_fstr(pinfo->cinfo, COL_INFO, ", Length: %u", can_info.len);
+ proto_item_append_text(can_tree, ", Length: %u", can_info.len);
+ proto_tree_add_item(can_tree, hf_canxl_acceptance_field, tvb, CANXL_LEN_OFFSET+2, 4, xl_encoding);
- col_set_str(pinfo->cinfo, COL_PROTOCOL, (can_packet_type == PACKET_TYPE_CAN_FD) ? "CANFD" : "CAN");
- col_clear(pinfo->cinfo, COL_INFO);
+ tvbuff_t *next_tvb;
- guint32 effective_can_id = (can_info.id & CAN_EFF_FLAG) ? can_info.id & CAN_EFF_MASK : can_info.id & CAN_SFF_MASK;
- char *id_name = (can_info.id & CAN_EFF_FLAG) ? "Ext. ID" : "ID";
- col_add_fstr(pinfo->cinfo, COL_INFO, "%s: %d (0x%" PRIx32 "), Length: %d", id_name, effective_can_id, effective_can_id, can_info.len);
+ next_tvb = tvb_new_subset_length(tvb, CANXL_DATA_OFFSET, can_info.len);
- socketcan_set_source_and_destination_columns(pinfo, &can_info);
+ if (!dissector_try_uint_new(canxl_sdu_type_dissector_table, sdu_type, next_tvb, pinfo, tree, TRUE, &can_info)) {
+ call_data_dissector(next_tvb, pinfo, tree);
+ }
- ti = proto_tree_add_item(tree, (can_packet_type == PACKET_TYPE_CAN_FD) ? proto_canfd : proto_can, tvb, 0, -1, ENC_NA);
- can_tree = proto_item_add_subtree(ti, (can_packet_type == PACKET_TYPE_CAN_FD) ? ett_can_fd : ett_can);
+ if (tvb_captured_length_remaining(tvb, CANXL_DATA_OFFSET+can_info.len) > 0) {
+ proto_tree_add_item(can_tree, hf_can_padding, tvb, CANXL_DATA_OFFSET+can_info.len, -1, ENC_NA);
+ }
+ } else {
+ if (can_packet_type == PACKET_TYPE_CAN_FD) {
+ can_info.fd = CAN_TYPE_CAN_FD;
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "CANFD");
+ } else {
+ can_info.fd = CAN_TYPE_CAN_CLASSIC;
+ col_set_str(pinfo->cinfo, COL_PROTOCOL, "CAN");
+ }
+ col_clear(pinfo->cinfo, COL_INFO);
- proto_item_append_text(can_tree, ", %s: %d (0x%" PRIx32 "), Length: %d", id_name, effective_can_id, effective_can_id, can_info.len);
+ ti = proto_tree_add_item(tree, proto_can, tvb, 0, -1, ENC_NA);
+ if (can_packet_type == PACKET_TYPE_CAN_FD) {
+ proto_item_set_hidden(ti);
+ ti = proto_tree_add_item(tree, proto_canfd, tvb, 0, -1, ENC_NA);
+ }
+ can_tree = proto_item_add_subtree(ti, (can_packet_type == PACKET_TYPE_CAN_FD) ? ett_can_fd : ett_can);
+
+ /* Get the ID and flags field */
+ can_info.id = tvb_get_guint32(tvb, 0, encoding);
+
+ /* Error Message Frames are only encapsulated in Classic CAN frames */
+ if (can_packet_type == PACKET_TYPE_CAN && (can_info.id & CAN_ERR_FLAG)) {
+ frame_type = LINUX_CAN_ERR;
+ can_flags_id = can_err_flags;
+ } else if (can_info.id & CAN_EFF_FLAG) {
+ frame_type = LINUX_CAN_EXT;
+ can_info.id &= (CAN_EFF_MASK | CAN_FLAG_MASK);
+ can_flags_id = (can_packet_type == PACKET_TYPE_CAN_FD) ? canfd_ext_flags_id : can_ext_flags_id;
+ } else {
+ frame_type = LINUX_CAN_STD;
+ can_info.id &= (CAN_SFF_MASK | CAN_FLAG_MASK);
+ can_flags_id = (can_packet_type == PACKET_TYPE_CAN_FD) ? canfd_std_flags_id : can_std_flags_id;
+ }
- proto_tree_add_bitmask_list(can_tree, tvb, 0, 4, can_flags, encoding);
- proto_tree_add_item(can_tree, hf_can_len, tvb, CAN_LEN_OFFSET, 1, ENC_NA);
+ socketcan_set_source_and_destination_columns(pinfo, &can_info);
- if (frame_type == LINUX_CAN_ERR && can_info.len != CAN_ERR_DLC) {
- proto_tree_add_expert(tree, pinfo, &ei_can_err_dlc_mismatch, tvb, CAN_LEN_OFFSET, 1);
- }
+ proto_tree_add_bitmask_list(can_tree, tvb, 0, 4, can_flags_id, encoding);
+ if (can_info.id & CAN_EFF_FLAG) {
+ col_add_fstr(pinfo->cinfo, COL_INFO, "Ext. ID: %u (0x%08x)", can_info.id & CAN_EFF_MASK, can_info.id & CAN_EFF_MASK);
+ proto_item_append_text(can_tree, ", Ext. ID: %u (0x%08x)", can_info.id & CAN_EFF_MASK, can_info.id & CAN_EFF_MASK);
+ } else {
+ col_add_fstr(pinfo->cinfo, COL_INFO, "ID: %u (0x%03x)", can_info.id & CAN_SFF_MASK, can_info.id & CAN_SFF_MASK);
+ proto_item_append_text(can_tree, ", ID: %u (0x%03x)", can_info.id & CAN_SFF_MASK, can_info.id & CAN_SFF_MASK);
+ }
+ proto_tree_add_item_ret_uint(can_tree, hf_can_len, tvb, CAN_LEN_OFFSET, 1, ENC_NA, &can_info.len);
+ col_append_fstr(pinfo->cinfo, COL_INFO, ", Length: %u", can_info.len);
+ proto_item_append_text(can_tree, ", Length: %u", can_info.len);
- if (can_packet_type == PACKET_TYPE_CAN_FD) {
- proto_tree_add_bitmask_list(can_tree, tvb, CANFD_FLAG_OFFSET, 1, canfd_flag_fields, ENC_NA);
- proto_tree_add_item(can_tree, hf_can_reserved, tvb, CANFD_FLAG_OFFSET+1, 2, ENC_NA);
- } else {
- proto_tree_add_item(can_tree, hf_can_reserved, tvb, CANFD_FLAG_OFFSET, 3, ENC_NA);
- }
+ if (frame_type == LINUX_CAN_ERR && can_info.len != CAN_ERR_DLC) {
+ proto_tree_add_expert(tree, pinfo, &ei_can_err_dlc_mismatch, tvb, CAN_LEN_OFFSET, 1);
+ }
- if (frame_type == LINUX_CAN_ERR) {
- int * const *flag;
- const char *sepa = ": ";
+ if (can_packet_type == PACKET_TYPE_CAN_FD) {
+ proto_tree_add_bitmask_list(can_tree, tvb, CANFD_FLAG_OFFSET, 1, canfd_flag_fields, ENC_NA);
+ proto_tree_add_item(can_tree, hf_can_reserved, tvb, CANFD_FLAG_OFFSET+1, 2, ENC_NA);
+ } else {
+ proto_tree_add_item(can_tree, hf_can_reserved, tvb, CANFD_FLAG_OFFSET, 3, ENC_NA);
+ }
- col_set_str(pinfo->cinfo, COL_INFO, "ERR");
+ if (frame_type == LINUX_CAN_ERR) {
+ int * const *flag;
+ const char *sepa = ": ";
- for (flag = can_err_flags; *flag; flag++) {
- header_field_info *hfi;
+ col_set_str(pinfo->cinfo, COL_INFO, "ERR");
- hfi = proto_registrar_get_nth(**flag);
- if (!hfi)
- continue;
+ for (flag = can_err_flags; *flag; flag++) {
+ header_field_info *hfi;
- if ((can_info.id & hfi->bitmask & ~CAN_FLAG_MASK) == 0)
- continue;
+ hfi = proto_registrar_get_nth(**flag);
+ if (!hfi)
+ continue;
- col_append_sep_str(pinfo->cinfo, COL_INFO, sepa, hfi->name);
- sepa = ", ";
- }
+ if ((can_info.id & hfi->bitmask & ~CAN_FLAG_MASK) == 0)
+ continue;
- if (can_info.id & CAN_ERR_LOSTARB) {
- proto_tree_add_item(can_tree, hf_can_err_lostarb_bit_number, tvb, CAN_DATA_OFFSET + 0, 1, ENC_NA);
- }
+ col_append_sep_str(pinfo->cinfo, COL_INFO, sepa, hfi->name);
+ sepa = ", ";
+ }
- if (can_info.id & CAN_ERR_CTRL) {
- static int * const can_err_ctrl_flags[] = {
- &hf_can_err_ctrl_rx_overflow,
- &hf_can_err_ctrl_tx_overflow,
- &hf_can_err_ctrl_rx_warning,
- &hf_can_err_ctrl_tx_warning,
- &hf_can_err_ctrl_rx_passive,
- &hf_can_err_ctrl_tx_passive,
- &hf_can_err_ctrl_active,
- NULL,
- };
-
- proto_tree_add_bitmask_list(can_tree, tvb, CAN_DATA_OFFSET+1, 1, can_err_ctrl_flags, ENC_NA);
- }
+ if (can_info.id & CAN_ERR_LOSTARB) {
+ proto_tree_add_item(can_tree, hf_can_err_lostarb_bit_number, tvb, CAN_DATA_OFFSET + 0, 1, ENC_NA);
+ }
- if (can_info.id & CAN_ERR_PROT) {
- static int * const can_err_prot_error_type_flags[] = {
- &hf_can_err_prot_error_type_bit,
- &hf_can_err_prot_error_type_form,
- &hf_can_err_prot_error_type_stuff,
- &hf_can_err_prot_error_type_bit0,
- &hf_can_err_prot_error_type_bit1,
- &hf_can_err_prot_error_type_overload,
- &hf_can_err_prot_error_type_active,
- &hf_can_err_prot_error_type_tx,
- NULL
- };
- proto_tree_add_bitmask_list(can_tree, tvb, CAN_DATA_OFFSET+2, 1, can_err_prot_error_type_flags, ENC_NA);
- proto_tree_add_item(can_tree, hf_can_err_prot_error_location, tvb, CAN_DATA_OFFSET+3, 1, ENC_NA);
- }
+ if (can_info.id & CAN_ERR_CTRL) {
+ static int * const can_err_ctrl_flags[] = {
+ &hf_can_err_ctrl_rx_overflow,
+ &hf_can_err_ctrl_tx_overflow,
+ &hf_can_err_ctrl_rx_warning,
+ &hf_can_err_ctrl_tx_warning,
+ &hf_can_err_ctrl_rx_passive,
+ &hf_can_err_ctrl_tx_passive,
+ &hf_can_err_ctrl_active,
+ NULL,
+ };
+
+ proto_tree_add_bitmask_list(can_tree, tvb, CAN_DATA_OFFSET+1, 1, can_err_ctrl_flags, ENC_NA);
+ }
+
+ if (can_info.id & CAN_ERR_PROT) {
+ static int * const can_err_prot_error_type_flags[] = {
+ &hf_can_err_prot_error_type_bit,
+ &hf_can_err_prot_error_type_form,
+ &hf_can_err_prot_error_type_stuff,
+ &hf_can_err_prot_error_type_bit0,
+ &hf_can_err_prot_error_type_bit1,
+ &hf_can_err_prot_error_type_overload,
+ &hf_can_err_prot_error_type_active,
+ &hf_can_err_prot_error_type_tx,
+ NULL
+ };
+ proto_tree_add_bitmask_list(can_tree, tvb, CAN_DATA_OFFSET+2, 1, can_err_prot_error_type_flags, ENC_NA);
+ proto_tree_add_item(can_tree, hf_can_err_prot_error_location, tvb, CAN_DATA_OFFSET+3, 1, ENC_NA);
+ }
- if (can_info.id & CAN_ERR_TRX) {
- proto_tree_add_item(can_tree, hf_can_err_trx_canh, tvb, CAN_DATA_OFFSET+4, 1, ENC_NA);
- proto_tree_add_item(can_tree, hf_can_err_trx_canl, tvb, CAN_DATA_OFFSET+4, 1, ENC_NA);
- }
+ if (can_info.id & CAN_ERR_TRX) {
+ proto_tree_add_item(can_tree, hf_can_err_trx_canh, tvb, CAN_DATA_OFFSET+4, 1, ENC_NA);
+ proto_tree_add_item(can_tree, hf_can_err_trx_canl, tvb, CAN_DATA_OFFSET+4, 1, ENC_NA);
+ }
- proto_tree_add_item(can_tree, hf_can_err_ctrl_specific, tvb, CAN_DATA_OFFSET+5, 3, ENC_NA);
- } else {
- tvbuff_t *next_tvb;
+ proto_tree_add_item(can_tree, hf_can_err_ctrl_specific, tvb, CAN_DATA_OFFSET+5, 3, ENC_NA);
+ } else {
+ tvbuff_t *next_tvb;
- if (can_info.id & CAN_RTR_FLAG) {
- col_append_str(pinfo->cinfo, COL_INFO, "(Remote Transmission Request)");
- }
+ if (can_info.id & CAN_RTR_FLAG) {
+ col_append_str(pinfo->cinfo, COL_INFO, "(Remote Transmission Request)");
+ }
- next_tvb = tvb_new_subset_length(tvb, CAN_DATA_OFFSET, can_info.len);
+ next_tvb = tvb_new_subset_length(tvb, CAN_DATA_OFFSET, can_info.len);
- if (!socketcan_call_subdissectors(next_tvb, pinfo, tree, &can_info, heuristic_first)) {
- call_data_dissector(next_tvb, pinfo, tree);
+ if (!socketcan_call_subdissectors(next_tvb, pinfo, tree, &can_info, heuristic_first)) {
+ call_data_dissector(next_tvb, pinfo, tree);
+ }
}
- }
- if (tvb_captured_length_remaining(tvb, CAN_DATA_OFFSET+can_info.len) > 0) {
- proto_tree_add_item(can_tree, hf_can_padding, tvb, CAN_DATA_OFFSET+can_info.len, -1, ENC_NA);
+ if (tvb_captured_length_remaining(tvb, CAN_DATA_OFFSET+can_info.len) > 0) {
+ proto_tree_add_item(can_tree, hf_can_padding, tvb, CAN_DATA_OFFSET+can_info.len, -1, ENC_NA);
+ }
}
return tvb_captured_length(tvb);
@@ -716,19 +849,33 @@ dissect_socketcan_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu
static int
dissect_socketcan_bigendian(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
return dissect_socketcan_common(tvb, pinfo, tree,
- byte_swap ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN, PACKET_TYPE_UNKNOWN);
+ byte_swap ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN,
+ ENC_LITTLE_ENDIAN,
+ PACKET_TYPE_UNKNOWN);
}
static int
dissect_socketcan_classic(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
return dissect_socketcan_common(tvb, pinfo, tree,
- byte_swap ? ENC_ANTI_HOST_ENDIAN : ENC_HOST_ENDIAN, PACKET_TYPE_CAN);
+ byte_swap ? ENC_ANTI_HOST_ENDIAN : ENC_HOST_ENDIAN,
+ ENC_HOST_ENDIAN, /* Not used, as this is CAN classic, not CAN XL */
+ PACKET_TYPE_CAN);
}
static int
dissect_socketcan_fd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
return dissect_socketcan_common(tvb, pinfo, tree,
- byte_swap ? ENC_ANTI_HOST_ENDIAN : ENC_HOST_ENDIAN, PACKET_TYPE_CAN_FD);
+ byte_swap ? ENC_ANTI_HOST_ENDIAN : ENC_HOST_ENDIAN,
+ ENC_HOST_ENDIAN, /* Not used, as this is CAN FD, not CAN XL */
+ PACKET_TYPE_CAN_FD);
+}
+
+static int
+dissect_socketcan_xl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
+ return dissect_socketcan_common(tvb, pinfo, tree,
+ byte_swap ? ENC_ANTI_HOST_ENDIAN : ENC_HOST_ENDIAN,
+ ENC_HOST_ENDIAN,
+ PACKET_TYPE_CAN_XL);
}
void
@@ -814,6 +961,18 @@ proto_register_socketcan(void) {
"Transceiver CANL status", "can.err.trx.canl", FT_UINT8, BASE_DEC, VALS(can_err_trx_canl_vals), 0xF0, NULL, HFILL } },
{ &hf_can_err_ctrl_specific, {
"Controller specific data", "can.err.ctrl_specific", FT_BYTES, SEP_SPACE, NULL, 0, NULL, HFILL } },
+ { &hf_canxl_priority, {
+ "Priority", "canxl.priority", FT_UINT32, BASE_DEC, NULL, 0x0000FFFF, NULL, HFILL } },
+ { &hf_canxl_vcid, {
+ "VCID", "canxl.vcid", FT_UINT32, BASE_DEC, NULL, 0x00FF0000, NULL, HFILL } },
+ { &hf_canxl_secflag, {
+ "Simple Extended Context", "canxl.flags.sec", FT_BOOLEAN, 8, NULL, CANXL_SEC, NULL, HFILL } },
+ { &hf_canxl_sdu_type, {
+ "SDU type", "canxl.sdu_type", FT_UINT8, BASE_HEX, VALS(canxl_sdu_type_vals), 0, NULL, HFILL } },
+ { &hf_canxl_len, {
+ "Frame-Length", "canxl.len", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } },
+ { &hf_canxl_acceptance_field, {
+ "Acceptance field", "canxl.acceptance_field", FT_UINT32, BASE_DEC_HEX, NULL, 0, NULL, HFILL } },
};
uat_t *can_interface_uat = NULL;
@@ -822,7 +981,8 @@ proto_register_socketcan(void) {
/* Setup protocol subtree array */
static gint *ett[] = {
&ett_can,
- &ett_can_fd
+ &ett_can_fd,
+ &ett_can_xl
};
static ei_register_info ei[] = {
@@ -841,6 +1001,11 @@ proto_register_socketcan(void) {
* or Busmaster capture that was saved as a pcap or pcapng file,
* as those use a linktype of LINKTYPE_WIRESHARK_UPPER_PDU with
* "can-hostendian" as the dissector name.
+ *
+ * "can-bigendian" is also a legacy name (fpr CAN XL frames, the
+ * fields in the header are in *little-endian* order); we keep it
+ * around for the same reason. It's used for the dissector for
+ * LINKTYPE_CAN_SOCKETCAN.
*/
socketcan_classic_handle = register_dissector("can-hostendian", dissect_socketcan_classic, proto_can);
socketcan_bigendian_handle = register_dissector("can-bigendian", dissect_socketcan_bigendian, proto_can);
@@ -848,6 +1013,9 @@ proto_register_socketcan(void) {
proto_canfd = proto_register_protocol("Controller Area Network FD", "CANFD", "canfd");
socketcan_fd_handle = register_dissector("canfd", dissect_socketcan_fd, proto_canfd);
+ proto_canxl = proto_register_protocol("Controller Area Network XL", "CANXL", "canxl");
+ socketcan_xl_handle = register_dissector("canxl", dissect_socketcan_xl, proto_canxl);
+
proto_register_field_array(proto_can, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
@@ -858,7 +1026,7 @@ proto_register_socketcan(void) {
prefs_register_obsolete_preference(can_module, "protocol");
prefs_register_bool_preference(can_module, "byte_swap", "Byte-swap the CAN ID/flags field",
- "Whether the CAN ID/flags field should be byte-swapped",
+ "Whether the CAN ID/flags field should be byte-swapped in CAN classic and CAN FD packets",
&byte_swap);
prefs_register_bool_preference(can_module, "try_heuristic_first", "Try heuristic sub-dissectors first",
@@ -871,6 +1039,8 @@ proto_register_socketcan(void) {
subdissector_table = register_decode_as_next_proto(proto_can, "can.subdissector", "CAN next level dissector", NULL);
+ canxl_sdu_type_dissector_table = register_dissector_table("canxl.sdu_type", "CAN XL SDU type", proto_canxl, FT_UINT8, BASE_HEX);
+
heur_subdissector_list = register_heur_dissector_list("can", proto_can);
static uat_field_t can_interface_mapping_uat_fields[] = {
@@ -933,6 +1103,7 @@ proto_reg_handoff_socketcan(void) {
dissector_add_uint("sll.ltype", LINUX_SLL_P_CAN, socketcan_classic_handle);
dissector_add_uint("sll.ltype", LINUX_SLL_P_CANFD, socketcan_fd_handle);
+ dissector_add_uint("sll.ltype", LINUX_SLL_P_CANXL, socketcan_xl_handle);
}
/*
diff --git a/epan/dissectors/packet-socketcan.h b/epan/dissectors/packet-socketcan.h
index 49a77224..f053dfa2 100644
--- a/epan/dissectors/packet-socketcan.h
+++ b/epan/dissectors/packet-socketcan.h
@@ -14,16 +14,48 @@
#include <epan/packet_info.h>
#include <epan/proto.h>
-/* Flags for CAN FD frames. */
+/*
+ * Flags for CAN FD frames.
+ * They are in the FD Flags field of a CAN FD frame.
+ *
+ * CANFD_FDF is in that field. and always set, as well as being present
+ * but *never* set in what's at the location corresponding to that field
+ * in a CAN classic frame, so we can distingish between CAN classic and
+ * CAN FD frames by testing that bit.
+ */
#define CANFD_BRS 0x01 /* Bit Rate Switch (second bitrate for payload data) */
#define CANFD_ESI 0x02 /* Error State Indicator of the transmitting node */
#define CANFD_FDF 0x04 /* FD flag - if set, this is an FD frame */
+/*
+ * Flags for CAN XL frames.
+ * They are in the Flags field of a CAN XL frame.
+ *
+ * CANXL_XLF is in that field, and always set. as well as being present
+ * but *never* set in what's the location corresponding to that field
+ * in a CAN classic or CAN FD frame, so we can distinguish between CAN
+ * XL and CAN classic/CAN FD frames by testing that bit.
+ */
+#define CANXL_XLF 0x80 /* XL flag - if set, this is an XL frame */
+#define CANXL_SEC 0x01 /* Simple Extended Content */
+
+/*
+ * CAN frame type.
+ *
+ * CAN_TYPE_CAN_CLASSIC is 0, and CAN_TYPE_CAN_FD is 1, so that the
+ * fd field behaves, for CAN classic and CAN FD frames, the same way
+ * that it did when it was a gboolean field that was FALSE for CAN classic
+ * frames and TRUE for CAN FD frames.
+ */
+#define CAN_TYPE_CAN_CLASSIC 0
+#define CAN_TYPE_CAN_FD 1
+#define CAN_TYPE_CAN_XL 2
+
/* Structure that gets passed between dissectors. */
typedef struct can_info {
guint32 id;
guint32 len;
- gboolean fd;
+ guint fd;
guint16 bus_id;
} can_info_t;
@@ -92,6 +124,16 @@ typedef struct can_info {
gboolean socketcan_call_subdissectors(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, struct can_info *can_info, const gboolean use_heuristics_first);
gboolean socketcan_set_source_and_destination_columns(packet_info* pinfo, can_info_t *caninfo);
+/*
+ * CAN XL SDU types.
+ */
+#define CANXL_SDU_TYPE_CONTENT_BASED_ADDRESSING 0x01
+#define CANXL_SDU_TYPE_CLASSICAL_CAN_AND_CAN_FD_MAPPED_TUNNELING 0x03
+#define CANXL_SDU_TYPE_IEEE_802_3_MAC_FRAME_TUNNELLING 0x04
+#define CANXL_SDU_TYPE_IEEE_802_3_MAC_FRAME_MAPPED_TUNNELING 0x05
+#define CANXL_SDU_TYPE_CLASSICAL_CAN_MAPPED_TUNNELING 0x06
+#define CANXL_SDU_TYPE_CAN_FD_MAPPED_TUNNELING 0x07
+
#endif /* __PACKET_SOCKETCAN_H__ */
/*
diff --git a/epan/dissectors/packet-socks.c b/epan/dissectors/packet-socks.c
index f84c3411..f96a1790 100644
--- a/epan/dissectors/packet-socks.c
+++ b/epan/dissectors/packet-socks.c
@@ -484,6 +484,7 @@ display_socks_v4(tvbuff_t *tvb, int offset, packet_info *pinfo,
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
client_display_socks_v5(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, socks_hash_entry_t *hash_info, sock_state_t* state_info) {
@@ -535,7 +536,9 @@ client_display_socks_v5(tvbuff_t *tvb, int offset, packet_info *pinfo,
(tvb_get_guint8(tvb, offset + 2) == 0) &&
(tvb_reported_length_remaining(tvb, offset + 2 + num_auth_methods) > 0)) {
new_state_info.client = clientV5Command;
+ increment_dissection_depth(pinfo);
client_display_socks_v5(tvb, offset, pinfo, tree, hash_info, &new_state_info);
+ decrement_dissection_depth(pinfo);
}
}
else if (state_info->client == clientV5Command) {
@@ -763,6 +766,7 @@ state_machine_v4( socks_hash_entry_t *hash_info, tvbuff_t *tvb,
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
client_state_machine_v5( socks_hash_entry_t *hash_info, tvbuff_t *tvb,
int offset, packet_info *pinfo, gboolean start_of_frame) {
@@ -788,7 +792,9 @@ client_state_machine_v5( socks_hash_entry_t *hash_info, tvbuff_t *tvb,
/* No authentication needed */
hash_info->clientState = clientV5Command;
if (tvb_reported_length_remaining(tvb, offset + 2 + num_auth_methods) > 0) {
+ increment_dissection_depth(pinfo);
client_state_machine_v5(hash_info, tvb, offset + 2 + num_auth_methods, pinfo, FALSE);
+ decrement_dissection_depth(pinfo);
}
} else {
hash_info->clientState = clientWaitForAuthReply;
diff --git a/epan/dissectors/packet-solaredge.c b/epan/dissectors/packet-solaredge.c
index 34e81c78..04b05e81 100644
--- a/epan/dissectors/packet-solaredge.c
+++ b/epan/dissectors/packet-solaredge.c
@@ -1029,6 +1029,7 @@ void solaredge_decrypt(const guint8 *in, gint length, guint8 *out, gcry_cipher_h
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_solaredge_devicedata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, gint length)
{
gint current_offset;
@@ -1054,6 +1055,7 @@ dissect_solaredge_devicedata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
current_offset = offset + SOLAREDGE_POST_HEADER_LENGTH;
col_append_str(pinfo->cinfo, COL_INFO, " ");
+ increment_dissection_depth(pinfo);
switch(device_header.type) {
case SOLAREDGE_DEVICETYPE_OPTIMIZER:
col_append_str(pinfo->cinfo, COL_INFO, "Optimizer");
@@ -1218,6 +1220,7 @@ dissect_solaredge_devicedata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
current_offset += device_header.device_length;
break;
}
+ decrement_dissection_depth(pinfo);
if (current_offset < length) {
col_append_str(pinfo->cinfo, COL_INFO, ", ");
@@ -1227,6 +1230,7 @@ dissect_solaredge_devicedata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_solaredge_recursive(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_, void *data _U_, gint ett, conversation_t *conv)
{
proto_item *ti;
@@ -1276,6 +1280,7 @@ dissect_solaredge_recursive(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
current_offset += 2;
col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(header.command_type, solaredge_packet_commandtypes, "Unknown command"));
+ increment_dissection_depth(pinfo);
switch (header.command_type) {
case SOLAREDGE_COMMAND_MISC_ENCRYPTED:
proto_tree_add_item(solaredge_header_tree, hf_solaredge_payload_type, tvb, current_offset, header.length, ENC_NA);
@@ -1335,6 +1340,7 @@ dissect_solaredge_recursive(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
current_offset += header.length;
break;
}
+ decrement_dissection_depth(pinfo);
/* Validate CRC */
proto_tree_add_checksum(solaredge_header_tree, tvb, SOLAREDGE_HEADER_LENGTH + header.length, hf_solaredge_crc_type, hf_solaredge_crc_status_type, &ei_solaredge_invalid_crc, pinfo, calculate_crc(&header, tvb_get_ptr(tvb, SOLAREDGE_HEADER_LENGTH, header.length), header.length), ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_VERIFY);
@@ -1653,11 +1659,7 @@ proto_register_solaredge(void)
&ett_solaredge_packet_post_device
};
- proto_solaredge = proto_register_protocol (
- "SolarEdge monitoring protocol",
- "SolarEdge",
- "solaredge"
- );
+ proto_solaredge = proto_register_protocol ("SolarEdge monitoring protocol", "SolarEdge", "solaredge");
solaredge_handle = register_dissector("solaredge", dissect_solaredge, proto_solaredge);
module_t * module_solaredge = prefs_register_protocol(proto_solaredge, NULL);
diff --git a/epan/dissectors/packet-someip.c b/epan/dissectors/packet-someip.c
index 97cc36cc..b6cc40eb 100644
--- a/epan/dissectors/packet-someip.c
+++ b/epan/dissectors/packet-someip.c
@@ -2962,6 +2962,7 @@ dissect_someip_payload_string(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_someip_payload_struct(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset_orig, guint32 id, gchar *name, gint wtlv_offset) {
someip_payload_parameter_struct_t *config = NULL;
@@ -3021,6 +3022,7 @@ dissect_someip_payload_struct(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_someip_payload_typedef(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, guint32 id, gchar *name _U_, int *hf_id, gint wtlv_offset) {
someip_payload_parameter_typedef_t *config = NULL;
@@ -3075,6 +3077,7 @@ dissect_someip_payload_array_dim_length(tvbuff_t *tvb, packet_info *pinfo, proto
/* returns bytes parsed, length needs to be gint to encode "non-existing" as -1 */
static gint
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_someip_payload_array_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset_orig, gint length, gint lower_limit, gint upper_limit,
someip_parameter_array_t *config) {
tvbuff_t *subtvb = NULL;
@@ -3123,6 +3126,7 @@ dissect_someip_payload_array_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tr
}
static gint
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_someip_payload_array_dim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset_orig, gint length, gint lower_limit, gint upper_limit, someip_parameter_array_t *config, guint current_dim, gchar *name, guint32 length_of_length) {
proto_item *ti = NULL;
proto_tree *subtree = NULL;
@@ -3171,6 +3175,7 @@ dissect_someip_payload_array_dim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_someip_payload_array(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset_orig, guint32 id, gchar *name, gint wtlv_offset) {
someip_parameter_array_t *config = NULL;
@@ -3222,6 +3227,7 @@ dissect_someip_payload_array(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_someip_payload_union(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset_orig, guint32 id, gchar *name, gint wtlv_offset) {
someip_parameter_union_t *config = NULL;
someip_parameter_union_item_t *item = NULL;
@@ -3301,9 +3307,11 @@ dissect_someip_payload_union(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_someip_payload_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, guint8 data_type, guint32 idref, gchar *name, int *hf_id_ptr, gint wtlv_offset) {
gint bytes_parsed = 0;
+ increment_dissection_depth(pinfo);
switch (data_type) {
case SOMEIP_PAYLOAD_PARAMETER_DATA_TYPE_TYPEDEF:
bytes_parsed = dissect_someip_payload_typedef(tvb, pinfo, tree, offset, idref, name, hf_id_ptr, wtlv_offset);
@@ -3331,6 +3339,7 @@ dissect_someip_payload_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
col_append_str(pinfo->cinfo, COL_INFO, " [SOME/IP: Payload Config Error]");
break;
}
+ decrement_dissection_depth(pinfo);
return bytes_parsed;
}
@@ -3412,6 +3421,7 @@ static int dissect_someip_payload_peek_length_of_length(proto_tree *tree, packet
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_someip_payload_parameters(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, someip_payload_parameter_item_t *items, guint32 num_of_items, gboolean wtlv) {
someip_payload_parameter_item_t *item;
@@ -3513,17 +3523,6 @@ dissect_someip_payload(tvbuff_t* tvb, packet_info* pinfo, proto_item *ti, guint1
proto_tree *tree = NULL;
- /* TAP */
- if (have_tap_listener(tap_someip_messages)) {
- someip_messages_tap_t *data = wmem_alloc(pinfo->pool, sizeof(someip_messages_tap_t));
- data->service_id = serviceid;
- data->method_id = methodid;
- data->interface_version = version;
- data->message_type = msgtype;
-
- tap_queue_packet(tap_someip_messages, pinfo, data);
- }
-
length = tvb_captured_length_remaining(tvb, 0);
tree = proto_item_add_subtree(ti, ett_someip_payload);
paramlist = get_parameter_config(serviceid, methodid, version, msgtype);
@@ -3738,7 +3737,18 @@ dissect_someip_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
subtvb = tvb_new_subset_length(tvb, SOMEIP_HDR_LEN, someip_payload_length);
}
- if (subtvb!=NULL) {
+ if (subtvb != NULL) {
+ /* TAP */
+ if (have_tap_listener(tap_someip_messages)) {
+ someip_messages_tap_t *stats_data = wmem_alloc(pinfo->pool, sizeof(someip_messages_tap_t));
+ stats_data->service_id = (guint16)someip_serviceid;
+ stats_data->method_id = (guint16)someip_methodid;
+ stats_data->interface_version = (guint8)version;
+ stats_data->message_type = (guint8)(~SOMEIP_MSGTYPE_TP_MASK) & msgtype;
+
+ tap_queue_packet(tap_someip_messages, pinfo, stats_data);
+ }
+
tvb_length = tvb_captured_length_remaining(subtvb, 0);
if (tvb_length > 0) {
tmp = dissector_try_uint_new(someip_dissector_table, someip_messageid, subtvb, pinfo, tree, FALSE, &someip_data);
diff --git a/epan/dissectors/packet-sua.c b/epan/dissectors/packet-sua.c
index 18768d94..56266e28 100644
--- a/epan/dissectors/packet-sua.c
+++ b/epan/dissectors/packet-sua.c
@@ -808,6 +808,7 @@ dissect_correlation_id_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_registration_result_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@@ -817,6 +818,7 @@ dissect_registration_result_parameter(tvbuff_t *parameter_tvb, packet_info *pinf
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_deregistration_result_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@@ -917,6 +919,7 @@ static const value_string routing_indicator_values[] = {
#define ADDRESS_SSN_BITMASK 0x0001
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_source_address_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree, guint8 *ssn)
{
proto_tree *address_indicator_tree;
@@ -938,6 +941,7 @@ dissect_source_address_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, pr
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_destination_address_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree, guint8 *ssn)
{
proto_tree *address_indicator_tree;
@@ -1179,6 +1183,7 @@ dissect_network_appearance_parameter(tvbuff_t *parameter_tvb, proto_tree *parame
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_routing_key_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@@ -1221,6 +1226,7 @@ dissect_tid_label_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree)
#define ADDRESS_RANGE_ADDRESS_PARAMETERS_OFFSET PARAMETER_VALUE_OFFSET
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_address_range_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *parameter_tree)
{
tvbuff_t *parameters_tvb;
@@ -1610,6 +1616,7 @@ static const value_string v8_parameter_tag_values[] = {
{ 0, NULL } };
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_v8_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, tvbuff_t **data_tvb, guint8 *source_ssn, guint8 *dest_ssn)
{
guint16 tag, length, padding_length;
@@ -1642,6 +1649,7 @@ dissect_v8_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tr
&& tag != V8_SUBSYSTEM_NUMBER_PARAMETER_TAG)
return;
+ increment_dissection_depth(pinfo);
switch(tag) {
case V8_DATA_PARAMETER_TAG:
dissect_data_parameter(parameter_tvb, parameter_tree, parameter_item, data_tvb);
@@ -1786,7 +1794,9 @@ dissect_v8_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tr
default:
dissect_unknown_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
- };
+ }
+ decrement_dissection_depth(pinfo);
+
if (parameter_tree && (padding_length > 0))
proto_tree_add_item(parameter_tree, hf_sua_parameter_padding, parameter_tvb, PARAMETER_HEADER_OFFSET + length, padding_length, ENC_NA);
}
@@ -1888,6 +1898,7 @@ static const value_string parameter_tag_values[] = {
{ 0, NULL } };
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree, tvbuff_t **data_tvb, guint8 *source_ssn, guint8 *dest_ssn)
{
guint16 tag, length, padding_length;
@@ -1937,6 +1948,7 @@ dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree
&& tag != SUBSYSTEM_NUMBER_PARAMETER_TAG)
return; /* Nothing to do here */
+ increment_dissection_depth(pinfo);
switch(tag) {
case DATA_PARAMETER_TAG:
dissect_data_parameter(parameter_tvb, parameter_tree, parameter_item, data_tvb);
@@ -2090,12 +2102,15 @@ dissect_parameter(tvbuff_t *parameter_tvb, packet_info *pinfo, proto_tree *tree
default:
dissect_unknown_parameter(parameter_tvb, parameter_tree, parameter_item);
break;
- };
+ }
+ decrement_dissection_depth(pinfo);
+
if (parameter_tree && (padding_length > 0))
proto_tree_add_item(parameter_tree, hf_sua_parameter_padding, parameter_tvb, PARAMETER_HEADER_OFFSET + length, padding_length, ENC_NA);
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_parameters(tvbuff_t *parameters_tvb, packet_info *pinfo, proto_tree *tree, tvbuff_t **data_tvb, guint8 *source_ssn, guint8 *dest_ssn)
{
gint offset, length, total_length, remaining_length;
diff --git a/epan/dissectors/packet-t38.c b/epan/dissectors/packet-t38.c
index 45127cde..00bd9c22 100644
--- a/epan/dissectors/packet-t38.c
+++ b/epan/dissectors/packet-t38.c
@@ -280,6 +280,7 @@ void t38_add_address(packet_info *pinfo,
p_conversation_data->setup_frame_number = setup_frame_number;
p_conversation_data->src_t38_info.reass_ID = 0;
p_conversation_data->src_t38_info.reass_start_seqnum = -1;
+ p_conversation_data->src_t38_info.reass_start_data_field = 0;
p_conversation_data->src_t38_info.reass_data_type = 0;
p_conversation_data->src_t38_info.last_seqnum = -1;
p_conversation_data->src_t38_info.packet_lost = 0;
@@ -291,6 +292,7 @@ void t38_add_address(packet_info *pinfo,
p_conversation_data->dst_t38_info.reass_ID = 0;
p_conversation_data->dst_t38_info.reass_start_seqnum = -1;
+ p_conversation_data->dst_t38_info.reass_start_data_field = 0;
p_conversation_data->dst_t38_info.reass_data_type = 0;
p_conversation_data->dst_t38_info.last_seqnum = -1;
p_conversation_data->dst_t38_info.packet_lost = 0;
@@ -353,8 +355,9 @@ force_reassemble_seq(reassembly_table *table, packet_info *pinfo, guint32 id)
last_fd=fd_i;
}
- data = (guint8 *) wmem_alloc(pinfo->pool, size);
+ data = (guint8 *) g_malloc(size);
fd_head->tvb_data = tvb_new_real_data(data, size, size);
+ tvb_set_free_cb(fd_head->tvb_data, g_free);
fd_head->len = size; /* record size for caller */
/* add all data fragments */
diff --git a/epan/dissectors/packet-tcap.c b/epan/dissectors/packet-tcap.c
index 2f6a4d3e..f134e298 100644
--- a/epan/dissectors/packet-tcap.c
+++ b/epan/dissectors/packet-tcap.c
@@ -3654,6 +3654,7 @@ static void cleanup_tcap(void)
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_tcap_param(asn1_ctx_t *actx, proto_tree *tree, tvbuff_t *tvb, int offset)
{
gint tag_offset, saved_offset, len_offset;
@@ -3696,7 +3697,9 @@ dissect_tcap_param(asn1_ctx_t *actx, proto_tree *tree, tvbuff_t *tvb, int offset
if (len-(2*ind_field)) /*should always be positive unless we get an empty contructor pointless? */
{
next_tvb = tvb_new_subset_length(tvb, offset, len-(2*ind_field));
+ increment_dissection_depth(actx->pinfo);
dissect_tcap_param(actx, subtree,next_tvb,0);
+ decrement_dissection_depth(actx->pinfo);
}
if (ind_field)
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c
index 4d10cf6f..aca6596e 100644
--- a/epan/dissectors/packet-tcp.c
+++ b/epan/dissectors/packet-tcp.c
@@ -5687,7 +5687,7 @@ static gboolean tcp_ignore_timestamps = FALSE;
static int
dissect_tcpopt_timestamp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
{
- proto_item *ti;
+ proto_item *ti, *tsval_ti;
proto_tree *ts_tree;
proto_item *length_item;
int offset = 0;
@@ -5706,7 +5706,7 @@ dissect_tcpopt_timestamp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo
if (!tcp_option_len_check(length_item, pinfo, len, TCPOLEN_TIMESTAMP))
return tvb_captured_length(tvb);
- ti = proto_tree_add_item_ret_uint(ts_tree, hf_tcp_option_timestamp_tsval, tvb, offset,
+ tsval_ti = proto_tree_add_item_ret_uint(ts_tree, hf_tcp_option_timestamp_tsval, tvb, offset,
4, ENC_BIG_ENDIAN, &ts_val);
proto_tree_add_item_ret_uint(ts_tree, hf_tcp_option_timestamp_tsecr, tvb, offset + 4,
@@ -5720,7 +5720,7 @@ dissect_tcpopt_timestamp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, vo
if (read_seq_as_syn_cookie) {
proto_item_append_text(ti, " (syn cookie)");
- proto_item* syncookie_ti = proto_item_add_subtree(ti, ett_tcp_syncookie_option);
+ proto_item* syncookie_ti = proto_item_add_subtree(tsval_ti, ett_tcp_syncookie_option);
guint32 timestamp = tvb_get_bits32(tvb, offset * 8, 26, ENC_NA) << 6;
proto_tree_add_uint_bits_format_value(syncookie_ti, hf_tcp_syncookie_option_timestamp, tvb, offset * 8,
26, timestamp, ENC_TIME_SECS, "%s", abs_time_secs_to_str(pinfo->pool, timestamp, ABSOLUTE_TIME_LOCAL, TRUE));
diff --git a/epan/dissectors/packet-teap.c b/epan/dissectors/packet-teap.c
index ac24f8cf..701e3389 100644
--- a/epan/dissectors/packet-teap.c
+++ b/epan/dissectors/packet-teap.c
@@ -256,6 +256,7 @@ static int
dissect_teap_tlv_pac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, guint16 len);
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_pac_attr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
{
guint16 type;
@@ -330,17 +331,21 @@ dissect_pac_attr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_teap_tlv_pac(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, guint16 len)
{
int start_offset = offset;
+ increment_dissection_depth(pinfo);
while (offset - start_offset < len) {
offset += dissect_pac_attr(tvb, pinfo, tree, offset);
}
+ decrement_dissection_depth(pinfo);
return offset - start_offset;
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_teap_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, gboolean top)
{
int start_offset = offset;
@@ -393,7 +398,9 @@ dissect_teap_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset
if (len > 6) {
next_tvb = tvb_new_subset_length(tvb, offset, len - 6);
+ increment_dissection_depth(pinfo);
offset += dissect_teap(next_tvb, pinfo, tlv_tree, NULL);
+ decrement_dissection_depth(pinfo);
}
break;
@@ -518,6 +525,7 @@ dissect_teap_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_teap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
proto_tree *ti;
diff --git a/epan/dissectors/packet-tecmp.c b/epan/dissectors/packet-tecmp.c
index e7689e76..d46b293d 100644
--- a/epan/dissectors/packet-tecmp.c
+++ b/epan/dissectors/packet-tecmp.c
@@ -1817,7 +1817,7 @@ dissect_tecmp_log_or_replay_stream(tvbuff_t *tvb, packet_info *pinfo, proto_tree
payload_tvb = tvb_new_subset_length(sub_tvb, offset2, length2);
offset2 += length2;
- can_info.fd = (data_type == TECMP_DATA_TYPE_CAN_FD_DATA);
+ can_info.fd = (data_type == TECMP_DATA_TYPE_CAN_FD_DATA) ? CAN_TYPE_CAN_FD : CAN_TYPE_CAN_CLASSIC;
can_info.len = length2;
can_info.bus_id = ht_interface_config_to_bus_id(interface_id);
diff --git a/epan/dissectors/packet-tftp.c b/epan/dissectors/packet-tftp.c
index e543ea88..075e754e 100644
--- a/epan/dissectors/packet-tftp.c
+++ b/epan/dissectors/packet-tftp.c
@@ -588,11 +588,22 @@ static void dissect_tftp_message(tftp_conv_info_t *tftp_info,
tftp_info->is_simple_file /* This is a simple file */
&& filename != NULL /* There is a file name */
&& !tftp_info->blocks_missing /* No missing blocks */
- && tftp_info->last_package_available /* Last package known */
+ && (tftp_info->last_package_available || !PINFO_FD_VISITED(pinfo))
+ /* If this is the first pass (i.e., this is tshark one-pass
+ * mode and we're tapping), then we can't know if the last
+ * block is present in the file yet. */
) {
- if (blocknum == 1 && !tftp_info->payload_data) {
+ if (PINFO_FD_VISITED(pinfo)) {
+ if (blocknum == 1 && !tftp_info->payload_data) {
tftp_info->payload_data = (guint8 *)g_try_malloc((gsize)tftp_info->file_length);
+ }
+ } else {
+ /* We allocate this in file scope so that it doesn't leak if it
+ * turns out we don't have all the blocks so we never send this
+ * to the tap.
+ */
+ tftp_info->payload_data = (guint8 *)wmem_realloc(wmem_file_scope(), tftp_info->payload_data, (gsize)tftp_info->file_length);
}
if (tftp_info->payload_data == NULL ||
@@ -779,7 +790,7 @@ is_valid_request_body(tvbuff_t *tvb)
guint len = tvb_strsize(tvb, offset);
const gchar* mode = tvb_format_stringzpad(wmem_packet_scope(), tvb, offset, len);
- const gchar* modes[] = {"netscii", "octet", "mail"};
+ const gchar* modes[] = {"netascii", "octet", "mail"};
for(guint i = 0; i < array_length(modes); ++i) {
if (g_ascii_strcasecmp(mode, modes[i]) == 0) return TRUE;
}
diff --git a/epan/dissectors/packet-thread.c b/epan/dissectors/packet-thread.c
index dfed394d..7c11f97e 100644
--- a/epan/dissectors/packet-thread.c
+++ b/epan/dissectors/packet-thread.c
@@ -1859,6 +1859,7 @@ dissect_thread_mc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_thread_nwd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{
proto_item *proto_root;
@@ -1874,6 +1875,7 @@ dissect_thread_nwd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
thread_nwd_tree = proto_item_add_subtree(proto_root, ett_thread_nwd);
/* Thread Network Data TLVs */
+ increment_dissection_depth(pinfo);
while (tvb_offset_exists(tvb, offset)) {
/* Get the length ahead of time to pass to next function so we can highlight
@@ -2093,6 +2095,7 @@ dissect_thread_nwd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
offset += tlv_len;
}
}
+ decrement_dissection_depth(pinfo);
return tvb_captured_length(tvb);
}
diff --git a/epan/dissectors/packet-thrift.c b/epan/dissectors/packet-thrift.c
index 9f03f0dd..a266c446 100644
--- a/epan/dissectors/packet-thrift.c
+++ b/epan/dissectors/packet-thrift.c
@@ -605,6 +605,12 @@ dissect_thrift_field_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* Create the field header sub-tree if requested only. */
if (tree != NULL) {
+ guint nested_count = p_get_proto_depth(pinfo, proto_thrift);
+ if (nested_count >= thrift_opt->nested_type_depth) {
+ expert_add_info(pinfo, proto_tree_get_parent(tree), &ei_thrift_too_many_subtypes);
+ return THRIFT_REQUEST_REASSEMBLY;
+ }
+
header->fh_tree = proto_tree_add_subtree_format(tree, tvb, header->type_offset, *offset - header->type_offset, ett_thrift_field, NULL,
"Field Header #%" PRId64, header->field_id);
if (thrift_opt->tprotocol & PROTO_THRIFT_COMPACT) {
@@ -1237,6 +1243,7 @@ dissect_thrift_t_string_enc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* Simple dispatch function for lists, sets, maps, and structs internal elements to avoid code duplication. */
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_thrift_t_member(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, thrift_option_data_t *thrift_opt, gboolean is_field, const thrift_member_t *elt)
{
switch (elt->type) {
@@ -1293,6 +1300,7 @@ dissect_thrift_t_member(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
* so it's easy to use the same code and handle the additional elements only when necessary.
*/
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_thrift_b_linear(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, thrift_option_data_t *thrift_opt, gboolean is_field, int field_id, gint hf_id, gint ett_id, const thrift_member_t *key, const thrift_member_t *val, thrift_type_enum_t expected)
{
proto_item *container_pi = NULL;
@@ -1300,6 +1308,7 @@ dissect_thrift_b_linear(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
proto_tree *sub_tree;
gint32 key_type, val_type;
gint32 length;
+ guint nested_count = p_get_proto_depth(pinfo, proto_thrift);
/* Get the current state of dissection. */
DISSECTOR_ASSERT(thrift_opt);
@@ -1312,6 +1321,11 @@ dissect_thrift_b_linear(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
}
/* Create the sub-tree. */
+ if (nested_count >= thrift_opt->nested_type_depth) {
+ expert_add_info(pinfo, proto_tree_get_parent(tree), &ei_thrift_too_many_subtypes);
+ return THRIFT_REQUEST_REASSEMBLY;
+ }
+ p_set_proto_depth(pinfo, proto_thrift, nested_count + 1);
container_pi = proto_tree_add_item(tree, hf_id, tvb, offset, -1, ENC_BIG_ENDIAN);
sub_tree = proto_item_add_subtree(container_pi, ett_id);
ABORT_SUBDISSECTION_ON_ISSUE(offset);
@@ -1386,6 +1400,7 @@ dissect_thrift_b_linear(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
if (container_pi && offset > 0) {
proto_item_set_end(container_pi, tvb, offset);
}
+ p_set_proto_depth(pinfo, proto_thrift, nested_count);
return offset;
}
@@ -1394,6 +1409,7 @@ dissect_thrift_b_linear(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
* this prevents code duplication.
*/
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_thrift_c_list_set(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, thrift_option_data_t *thrift_opt, gboolean is_field, int field_id, gint hf_id, gint ett_id, const thrift_member_t *elt, gboolean is_list)
{
proto_item *container_pi;
@@ -1408,6 +1424,7 @@ dissect_thrift_c_list_set(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i
int hf_num_item = hf_thrift_num_set_item;
int hf_pos_item = hf_thrift_num_set_pos;
thrift_type_enum_t expected = DE_THRIFT_T_SET;
+ guint nested_count = p_get_proto_depth(pinfo, proto_thrift);
if (is_list) {
hf_num_item = hf_thrift_num_list_item;
@@ -1430,6 +1447,11 @@ dissect_thrift_c_list_set(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i
}
/* Create the sub-tree. */
+ if (nested_count >= thrift_opt->nested_type_depth) {
+ expert_add_info(pinfo, proto_tree_get_parent(tree), &ei_thrift_too_many_subtypes);
+ return THRIFT_REQUEST_REASSEMBLY;
+ }
+ p_set_proto_depth(pinfo, proto_thrift, nested_count + 1);
container_pi = proto_tree_add_item(tree, hf_id, tvb, offset, -1, ENC_BIG_ENDIAN);
sub_tree = proto_item_add_subtree(container_pi, ett_id);
@@ -1490,10 +1512,12 @@ dissect_thrift_c_list_set(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, i
if (container_pi && offset > 0) {
proto_item_set_end(container_pi, tvb, offset);
}
+ p_set_proto_depth(pinfo, proto_thrift, nested_count);
return offset;
}
int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_thrift_t_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, thrift_option_data_t *thrift_opt, gboolean is_field, int field_id, gint hf_id, gint ett_id, const thrift_member_t *elt)
{
int result;
@@ -1510,6 +1534,7 @@ dissect_thrift_t_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int o
}
int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_thrift_t_set(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, thrift_option_data_t *thrift_opt, gboolean is_field, int field_id, gint hf_id, gint ett_id, const thrift_member_t *elt)
{
int result;
@@ -1526,6 +1551,7 @@ dissect_thrift_t_set(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of
}
int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_thrift_t_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, thrift_option_data_t *thrift_opt, gboolean is_field, int field_id, gint hf_id, gint ett_id, const thrift_member_t *key, const thrift_member_t *value)
{
int result;
@@ -1544,6 +1570,7 @@ dissect_thrift_t_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of
gint32 len_offset = offset;
thrift_compact_type_enum_t ktype, vtype;
guint64 varint;
+ guint nested_count = p_get_proto_depth(pinfo, proto_thrift);
/* Dissect field header if necessary. */
if (is_field) {
@@ -1576,12 +1603,18 @@ dissect_thrift_t_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of
}
/* Create the sub-tree. */
+ if (nested_count >= thrift_opt->nested_type_depth) {
+ expert_add_info(pinfo, proto_tree_get_parent(tree), &ei_thrift_too_many_subtypes);
+ return THRIFT_REQUEST_REASSEMBLY;
+ }
+ p_set_proto_depth(pinfo, proto_thrift, nested_count + 1);
container_pi = proto_tree_add_item(tree, hf_id, tvb, len_offset, -1, ENC_BIG_ENDIAN);
sub_tree = proto_item_add_subtree(container_pi, ett_id);
if (container_len == 0) {
proto_item_set_end(container_pi, tvb, offset);
proto_item_append_text(container_pi, " (Empty)");
+ p_set_proto_depth(pinfo, proto_thrift, nested_count);
return offset;
}
@@ -1628,6 +1661,7 @@ dissect_thrift_t_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of
proto_item_set_end(container_pi, tvb, offset);
}
result = offset;
+ p_set_proto_depth(pinfo, proto_thrift, nested_count);
}
if (is_field) {
@@ -1643,6 +1677,7 @@ dissect_thrift_t_struct(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_thrift_t_struct_expert(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, thrift_option_data_t *thrift_opt, gboolean is_field, int field_id, gint hf_id, gint ett_id, const thrift_member_t *seq, expert_field* ei)
{
thrift_field_header_t field_header;
@@ -1650,6 +1685,7 @@ dissect_thrift_t_struct_expert(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
proto_item *type_pi = NULL;
gboolean enable_subtree = (ett_id != DISABLE_SUBTREE) || (hf_id != DISABLE_SUBTREE);
+ guint nested_count = p_get_proto_depth(pinfo, proto_thrift);
/* Get the current state of dissection. */
DISSECTOR_ASSERT(thrift_opt);
@@ -1670,6 +1706,11 @@ dissect_thrift_t_struct_expert(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
/* Create the sub-tree, if not explicitly refused. */
if (enable_subtree) {
/* Add the struct to the tree. */
+ if (nested_count >= thrift_opt->nested_type_depth) {
+ expert_add_info(pinfo, proto_tree_get_parent(tree), &ei_thrift_too_many_subtypes);
+ return THRIFT_REQUEST_REASSEMBLY;
+ }
+ p_set_proto_depth(pinfo, proto_thrift, nested_count--);
type_pi = proto_tree_add_item(tree, hf_id, tvb, offset, -1, ENC_BIG_ENDIAN);
sub_tree = proto_item_add_subtree(type_pi, ett_id);
} else {
@@ -1763,6 +1804,7 @@ dissect_thrift_t_struct_expert(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr
if (is_field) {
thrift_opt->previous_field_id = field_id;
}
+ p_set_proto_depth(pinfo, proto_thrift, nested_count);
return offset;
}
/*=====END SUB-DISSECTION=====*/
@@ -1841,6 +1883,7 @@ dissect_thrift_binary_binary(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_thrift_binary_linear(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, thrift_option_data_t *thrift_opt, thrift_type_enum_t expected)
{
/* Binary protocol list and set (5 bytes + elements):
@@ -1868,6 +1911,7 @@ dissect_thrift_binary_linear(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
int hf_num_item = -1;
int hf_vtype = hf_thrift_type;
int min_len = TBP_THRIFT_LINEAR_LEN;
+ guint nested_count = p_get_proto_depth(pinfo, proto_thrift);
/* Set the different hf_id & ett depending on effective type. */
switch (expected) {
@@ -1895,6 +1939,11 @@ dissect_thrift_binary_linear(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
ABORT_ON_INCOMPLETE_PDU(min_len);
/* Create the sub-tree. */
+ if (nested_count >= thrift_opt->nested_type_depth) {
+ expert_add_info(pinfo, proto_tree_get_parent(tree), &ei_thrift_too_many_subtypes);
+ return THRIFT_REQUEST_REASSEMBLY;
+ }
+ p_set_proto_depth(pinfo, proto_thrift, nested_count + 1);
container_pi = proto_tree_add_item(tree, hf_container, tvb, *offset, -1, ENC_NA);
sub_tree = proto_item_add_subtree(container_pi, ett);
@@ -1925,28 +1974,33 @@ dissect_thrift_binary_linear(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
}
proto_item_set_end(container_pi, tvb, *offset);
+ p_set_proto_depth(pinfo, proto_thrift, nested_count);
return *offset;
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_thrift_binary_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, thrift_option_data_t *thrift_opt)
{
return dissect_thrift_binary_linear(tvb, pinfo, tree, offset, thrift_opt, DE_THRIFT_T_LIST);
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_thrift_binary_set(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, thrift_option_data_t *thrift_opt)
{
return dissect_thrift_binary_linear(tvb, pinfo, tree, offset, thrift_opt, DE_THRIFT_T_SET);
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_thrift_binary_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, thrift_option_data_t *thrift_opt)
{
return dissect_thrift_binary_linear(tvb, pinfo, tree, offset, thrift_opt, DE_THRIFT_T_MAP);
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_thrift_binary_fields(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, thrift_option_data_t *thrift_opt)
{
/*
@@ -1992,6 +2046,7 @@ dissect_thrift_binary_fields(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_thrift_binary_struct(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, thrift_option_data_t *thrift_opt)
{
/* This function only creates the "Struct" sub-tree
@@ -1999,8 +2054,14 @@ dissect_thrift_binary_struct(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
*/
proto_tree *sub_tree;
proto_item *pi;
+ guint nested_count = p_get_proto_depth(pinfo, proto_thrift);
ABORT_ON_INCOMPLETE_PDU(TBP_THRIFT_STRUCT_LEN);
+ if (nested_count >= thrift_opt->nested_type_depth) {
+ expert_add_info(pinfo, proto_tree_get_parent(tree), &ei_thrift_too_many_subtypes);
+ return THRIFT_REQUEST_REASSEMBLY;
+ }
+ p_set_proto_depth(pinfo, proto_thrift, nested_count + 1);
pi = proto_tree_add_item(tree, hf_thrift_struct, tvb, *offset, -1, ENC_NA);
sub_tree = proto_item_add_subtree(pi, ett_thrift_struct);
@@ -2009,19 +2070,14 @@ dissect_thrift_binary_struct(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
} else {
proto_item_set_end(pi, tvb, *offset);
}
+ p_set_proto_depth(pinfo, proto_thrift, nested_count);
return *offset;
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_thrift_binary_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, thrift_option_data_t *thrift_opt, proto_tree *header_tree, int type, proto_item *type_pi)
{
- guint nested_count = p_get_proto_depth(pinfo, proto_thrift);
- if (++nested_count > thrift_opt->nested_type_depth) {
- expert_add_info(pinfo, proto_tree_get_parent(tree), &ei_thrift_too_many_subtypes);
- return THRIFT_REQUEST_REASSEMBLY;
- }
- p_set_proto_depth(pinfo, proto_thrift, nested_count);
-
switch (type) {
case DE_THRIFT_T_BOOL:
ABORT_ON_INCOMPLETE_PDU(TBP_THRIFT_BOOL_LEN);
@@ -2089,7 +2145,6 @@ dissect_thrift_binary_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
return THRIFT_REQUEST_REASSEMBLY;
}
- p_set_proto_depth(pinfo, proto_thrift, --nested_count);
return *offset;
}
/*=====END BINARY GENERIC DISSECTION=====*/
@@ -2156,6 +2211,7 @@ dissect_thrift_compact_binary(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_thrift_compact_list_set(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, thrift_option_data_t *thrift_opt, gboolean is_list)
{
/* Compact protocol list/set (short form, 1 byte):
@@ -2183,6 +2239,7 @@ dissect_thrift_compact_list_set(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
int hf_container = hf_thrift_set;
int hf_num_item = hf_thrift_num_set_item;
int hf_pos_item = hf_thrift_num_set_pos;
+ guint nested_count = p_get_proto_depth(pinfo, proto_thrift);
ABORT_ON_INCOMPLETE_PDU(TBP_THRIFT_TYPE_LEN);
/* Set the different hf_id & ett depending on effective type. */
@@ -2194,6 +2251,11 @@ dissect_thrift_compact_list_set(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
}
/* Create the sub-tree. */
+ if (nested_count >= thrift_opt->nested_type_depth) {
+ expert_add_info(pinfo, proto_tree_get_parent(tree), &ei_thrift_too_many_subtypes);
+ return THRIFT_REQUEST_REASSEMBLY;
+ }
+ p_set_proto_depth(pinfo, proto_thrift, nested_count + 1);
container_pi = proto_tree_add_item(tree, hf_container, tvb, *offset, -1, ENC_NA);
sub_tree = proto_item_add_subtree(container_pi, ett);
@@ -2244,22 +2306,26 @@ dissect_thrift_compact_list_set(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t
}
proto_item_set_end(container_pi, tvb, *offset);
+ p_set_proto_depth(pinfo, proto_thrift, nested_count);
return *offset;
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_thrift_compact_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, thrift_option_data_t *thrift_opt)
{
return dissect_thrift_compact_list_set(tvb, pinfo, tree, offset, thrift_opt, TRUE);
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_thrift_compact_set(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, thrift_option_data_t *thrift_opt)
{
return dissect_thrift_compact_list_set(tvb, pinfo, tree, offset, thrift_opt, FALSE);
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_thrift_compact_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, thrift_option_data_t *thrift_opt)
{
/* Compact protocol map header (1 byte, empty map):
@@ -2284,9 +2350,15 @@ dissect_thrift_compact_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
guint32 types, ktype, vtype;
gint32 container_len, len_len, i;
guint64 varint;
+ guint nested_count = p_get_proto_depth(pinfo, proto_thrift);
ABORT_ON_INCOMPLETE_PDU(TCP_THRIFT_MIN_VARINT_LEN);
/* Create the sub-tree. */
+ if (nested_count >= thrift_opt->nested_type_depth) {
+ expert_add_info(pinfo, proto_tree_get_parent(tree), &ei_thrift_too_many_subtypes);
+ return THRIFT_REQUEST_REASSEMBLY;
+ }
+ p_set_proto_depth(pinfo, proto_thrift, nested_count + 1);
container_pi = proto_tree_add_item(tree, hf_thrift_map, tvb, *offset, -1, ENC_NA);
sub_tree = proto_item_add_subtree(container_pi, ett_thrift_map);
@@ -2338,10 +2410,12 @@ dissect_thrift_compact_map(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
}
proto_item_set_end(container_pi, tvb, *offset);
+ p_set_proto_depth(pinfo, proto_thrift, nested_count);
return *offset;
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_thrift_compact_fields(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, thrift_option_data_t *thrift_opt)
{
/*
@@ -2395,6 +2469,7 @@ dissect_thrift_compact_fields(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
}
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_thrift_compact_struct(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, thrift_option_data_t *thrift_opt)
{
/* This function only creates the "Struct" sub-tree
@@ -2402,8 +2477,14 @@ dissect_thrift_compact_struct(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
*/
proto_tree *sub_tree;
proto_item *pi;
+ guint nested_count = p_get_proto_depth(pinfo, proto_thrift);
ABORT_ON_INCOMPLETE_PDU(TCP_THRIFT_STRUCT_LEN);
+ if (nested_count >= thrift_opt->nested_type_depth) {
+ expert_add_info(pinfo, proto_tree_get_parent(tree), &ei_thrift_too_many_subtypes);
+ return THRIFT_REQUEST_REASSEMBLY;
+ }
+ p_set_proto_depth(pinfo, proto_thrift, nested_count + 1);
pi = proto_tree_add_item(tree, hf_thrift_struct, tvb, *offset, -1, ENC_NA);
sub_tree = proto_item_add_subtree(pi, ett_thrift_struct);
@@ -2412,6 +2493,7 @@ dissect_thrift_compact_struct(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
} else {
proto_item_set_end(pi, tvb, *offset);
}
+ p_set_proto_depth(pinfo, proto_thrift, nested_count);
return *offset;
}
@@ -2422,15 +2504,9 @@ dissect_thrift_compact_struct(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
* the bool type which is encoded in the same way as BOOL_FALSE (2).
*/
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_thrift_compact_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, thrift_option_data_t *thrift_opt, proto_tree *header_tree, int type, proto_item *type_pi)
{
- guint nested_count = p_get_proto_depth(pinfo, proto_thrift);
- if (++nested_count > thrift_opt->nested_type_depth) {
- expert_add_info(pinfo, proto_tree_get_parent(tree), &ei_thrift_too_many_subtypes);
- return THRIFT_REQUEST_REASSEMBLY;
- }
- p_set_proto_depth(pinfo, proto_thrift, nested_count);
-
switch (type) {
case DE_THRIFT_C_BOOL_FALSE:
ABORT_ON_INCOMPLETE_PDU(TBP_THRIFT_BOOL_LEN);
@@ -2504,7 +2580,6 @@ dissect_thrift_compact_type(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
return THRIFT_REQUEST_REASSEMBLY;
}
- p_set_proto_depth(pinfo, proto_thrift, --nested_count);
return *offset;
}
/*=====END COMPACT GENERIC DISSECTION=====*/
diff --git a/epan/dissectors/packet-tls-utils.c b/epan/dissectors/packet-tls-utils.c
index c30d57f2..a2572b7b 100644
--- a/epan/dissectors/packet-tls-utils.c
+++ b/epan/dissectors/packet-tls-utils.c
@@ -1508,7 +1508,7 @@ const value_string tls_cert_status_type[] = {
};
/* Generated by tools/make-tls-ct-logids.py
- * Last-Modified Sun, 19 Nov 2023 13:18:00 GMT, 137 entries. */
+ * Last-Modified Sat, 27 Jan 2024 13:28:00 GMT, 138 entries. */
static const bytes_string ct_logids[] = {
{ (const uint8_t[]){
0xb2, 0x1e, 0x05, 0xcc, 0x8b, 0xa2, 0xcd, 0x8a, 0x20, 0x4e, 0x87,
@@ -2027,6 +2027,12 @@ static const bytes_string ct_logids[] = {
},
32, "Sectigo 'Mammoth2024h1'" },
{ (const uint8_t[]){
+ 0x50, 0x85, 0x01, 0x58, 0xdc, 0xb6, 0x05, 0x95, 0xc0, 0x0e, 0x92,
+ 0xa8, 0x11, 0x02, 0xec, 0xcd, 0xfe, 0x3f, 0x6b, 0x78, 0x58, 0x42,
+ 0x9f, 0x57, 0x98, 0x35, 0x38, 0xc9, 0xda, 0x52, 0x50, 0x63,
+ },
+ 32, "Sectigo 'Mammoth2024h1b'" },
+ { (const uint8_t[]){
0xdf, 0xe1, 0x56, 0xeb, 0xaa, 0x05, 0xaf, 0xb5, 0x9c, 0x0f, 0x86,
0x71, 0x8d, 0xa8, 0xc0, 0x32, 0x4e, 0xae, 0x56, 0xd9, 0x6e, 0xa7,
0xf5, 0xa5, 0x6a, 0x01, 0xd1, 0xc1, 0x3b, 0xbe, 0x52, 0x5c,
diff --git a/epan/dissectors/packet-tn5250.c b/epan/dissectors/packet-tn5250.c
index 52e58d3c..c799dade 100644
--- a/epan/dissectors/packet-tn5250.c
+++ b/epan/dissectors/packet-tn5250.c
@@ -4917,6 +4917,7 @@ dissect_tn5250_data_until_next_command(proto_tree *tn5250_tree, tvbuff_t *tvb, g
#endif
static guint32
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_outbound_stream(proto_tree *tn5250_tree, packet_info *pinfo, tvbuff_t *tvb, gint offset)
{
gint command_code;
@@ -4964,7 +4965,9 @@ dissect_outbound_stream(proto_tree *tn5250_tree, packet_info *pinfo, tvbuff_t *t
break;
case RESTORE_SCREEN:
while (tvb_reported_length_remaining(tvb, offset) > 0) {
+ increment_dissection_depth(pinfo);
offset += dissect_outbound_stream(cc_tree, pinfo, tvb, offset);
+ decrement_dissection_depth(pinfo);
}
break;
case WRITE_ERROR_CODE_TO_WINDOW:
diff --git a/epan/dissectors/packet-usb-hid.c b/epan/dissectors/packet-usb-hid.c
index afd4bfd8..9a402ee8 100644
--- a/epan/dissectors/packet-usb-hid.c
+++ b/epan/dissectors/packet-usb-hid.c
@@ -4330,6 +4330,7 @@ dissect_usb_hid_report_localitem_data(packet_info *pinfo, proto_tree *tree, tvbu
/* Dissector for individual HID report items. Recursive. */
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_usb_hid_report_item(packet_info *pinfo _U_, proto_tree *parent_tree, tvbuff_t *tvb, int offset, usb_conv_info_t *usb_conv_info _U_, const struct usb_hid_global_state *global)
{
proto_item *subitem;
@@ -4409,7 +4410,9 @@ dissect_usb_hid_report_item(packet_info *pinfo _U_, proto_tree *parent_tree, tvb
if (bType == USBHID_ITEMTYPE_MAIN) {
if (bTag == USBHID_MAINITEM_TAG_COLLECTION) {
/* Begin collection, nest following elements under us */
+ increment_dissection_depth(pinfo);
offset = dissect_usb_hid_report_item(pinfo, subtree, tvb, offset, usb_conv_info, &cur_global);
+ decrement_dissection_depth(pinfo);
proto_item_set_len(subitem, offset-old_offset);
} else if (bTag == USBHID_MAINITEM_TAG_ENDCOLLECTION) {
/* End collection, break out to parent tree item */
diff --git a/epan/dissectors/packet-usb-video.c b/epan/dissectors/packet-usb-video.c
index 5e9d632c..42aaf0b6 100644
--- a/epan/dissectors/packet-usb-video.c
+++ b/epan/dissectors/packet-usb-video.c
@@ -1582,8 +1582,9 @@ get_control_selector_values(guint8 entity_id, usb_conv_info_t *usb_conv_info)
video_entity_t *entity = NULL;
value_string_ext *selectors = NULL;
- if (usb_conv_info == NULL)
+ if (usb_conv_info == NULL || usb_conv_info->class_data_type != USB_CONV_VIDEO) {
return NULL;
+ }
video_conv_info = (video_conv_info_t *)usb_conv_info->class_data;
if (video_conv_info)
diff --git a/epan/dissectors/packet-vp9.c b/epan/dissectors/packet-vp9.c
index cab0ad31..7f34fafd 100644
--- a/epan/dissectors/packet-vp9.c
+++ b/epan/dissectors/packet-vp9.c
@@ -235,7 +235,7 @@ dissect_vp9(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_, void *data
V: | N_S |Y|G|-|-|-|
+-+-+-+-+-+-+-+-+
*/
- guint8 n_s = tvb_get_guint8(tvb, offset) & (VP9_3_BITS_MASK);
+ guint8 n_s = (tvb_get_guint8(tvb, offset) & (VP9_3_BITS_MASK)) >> 5;
guint8 y = tvb_get_guint8(tvb, offset) & (VP9_1_BIT_MASK >> 3);
guint8 g = tvb_get_guint8(tvb, offset) & (VP9_1_BIT_MASK >> 4);
proto_tree_add_item(vp9_descriptor_tree, hf_vp9_pld_n_s_bits, tvb, offset, 1, ENC_BIG_ENDIAN);
diff --git a/epan/dissectors/packet-wassp.c b/epan/dissectors/packet-wassp.c
index 7b78b353..595bf021 100644
--- a/epan/dissectors/packet-wassp.c
+++ b/epan/dissectors/packet-wassp.c
@@ -4736,6 +4736,7 @@ static int decode_lbs_tag_header(proto_tree *tree, tvbuff_t *tvb, int offset)
+// NOLINTNEXTLINE(misc-no-recursion)
int dissect_wassp_sub_tlv(proto_tree *wassp_tree, tvbuff_t *tvb, packet_info *pinfo, int offset, int in_len, int which_tab, int ru_msg_type)
{
proto_item *tlvi;
@@ -4921,9 +4922,11 @@ int dissect_wassp_sub_tlv(proto_tree *wassp_tree, tvbuff_t *tvb, packet_info *pi
tableNo = WASSP_SUBTLV_GET_ENTRY_IDX_TABIDX(tmp_decr, tlv_type);
if ((tableNo == RADIO_CONFIG_BLOCK) && (ru_msg_type == WASSP_RU_Ack))
{
+ // We recurse here, but we'll run out of packet before we run out of stack.
offset = dissect_wassp_sub_tlv(tmp_tree, tvb, pinfo, offset + TLV_VALUE, length - TLV_VALUE, TAB_RU_ACK_RADIO_CONFIG, ru_msg_type);
}
else
+ // We recurse here, but we'll run out of packet before we run out of stack.
offset = dissect_wassp_sub_tlv(tmp_tree, tvb, pinfo, offset + TLV_VALUE, length - TLV_VALUE, tableNo, ru_msg_type);
}
diff --git a/epan/dissectors/packet-windows-common.c b/epan/dissectors/packet-windows-common.c
index 1ccba706..b591d8d8 100644
--- a/epan/dissectors/packet-windows-common.c
+++ b/epan/dissectors/packet-windows-common.c
@@ -1980,7 +1980,8 @@ dissect_nt_ace_system_resource_attribute(tvbuff_t *tvb, int offset, guint16 size
/* Dissect Condition ACE token, see [MS-DTYP] v20180912 section 2.4.4.17.4 */
static int
-dissect_nt_conditional_ace_token(tvbuff_t *tvb, int offset, guint16 size, proto_tree *parent_tree)
+// NOLINTNEXTLINE(misc-no-recursion)
+dissect_nt_conditional_ace_token(tvbuff_t *tvb, packet_info *pinfo, int offset, guint16 size, proto_tree *parent_tree)
{
int start_offset = offset;
proto_tree *tree = parent_tree;
@@ -2092,8 +2093,11 @@ dissect_nt_conditional_ace_token(tvbuff_t *tvb, int offset, guint16 size, proto_
int remaining = size - (offset - start_offset);
if (remaining >= (int)len) {
int end_offset = offset + len;
- while (offset < end_offset)
- offset = dissect_nt_conditional_ace_token(tvb, offset, remaining, tree);
+ increment_dissection_depth(pinfo);
+ while (offset < end_offset) {
+ offset = dissect_nt_conditional_ace_token(tvb, pinfo, offset, remaining, tree);
+ }
+ decrement_dissection_depth(pinfo);
} else {
/* malformed: composite len is longer
* than the remaining data in the ace
@@ -2161,7 +2165,7 @@ dissect_nt_conditional_ace_token(tvbuff_t *tvb, int offset, guint16 size, proto_
/* Dissect Conditional ACE (if present), see [MS-DTYP] v20180912 section 2.4.4.17.4 */
static int
-dissect_nt_conditional_ace(tvbuff_t *tvb, int offset, guint16 size, proto_tree *parent_tree)
+dissect_nt_conditional_ace(tvbuff_t *tvb, packet_info *pinfo, int offset, guint16 size, proto_tree *parent_tree)
{
int start_offset = offset;
@@ -2183,7 +2187,7 @@ dissect_nt_conditional_ace(tvbuff_t *tvb, int offset, guint16 size, proto_tree *
remaining = size - (offset - start_offset);
if (remaining <= 0)
break;
- offset = dissect_nt_conditional_ace_token(tvb, offset, remaining, parent_tree);
+ offset = dissect_nt_conditional_ace_token(tvb, pinfo, offset, remaining, parent_tree);
}
}
}
@@ -2746,7 +2750,7 @@ dissect_nt_v2_ace(tvbuff_t *tvb, int offset, packet_info *pinfo,
case ACE_TYPE_ACCESS_DENIED_CALLBACK_OBJECT:
case ACE_TYPE_SYSTEM_AUDIT_CALLBACK:
case ACE_TYPE_SYSTEM_AUDIT_CALLBACK_OBJECT:
- dissect_nt_conditional_ace(tvb, offset, data_size, tree);
+ dissect_nt_conditional_ace(tvb, pinfo, offset, data_size, tree);
break;
case ACE_TYPE_SYSTEM_RESOURCE_ATTRIBUTE:
diff --git a/epan/dissectors/packet-wlccp.c b/epan/dissectors/packet-wlccp.c
index 9fe1a946..6b20011c 100644
--- a/epan/dissectors/packet-wlccp.c
+++ b/epan/dissectors/packet-wlccp.c
@@ -1795,6 +1795,7 @@ static guint dissect_wlccp_mip_msg(proto_tree *_tree _U_, tvbuff_t *_tvb _U_, gu
/***************************************************************************************************/
+// NOLINTNEXTLINE(misc-no-recursion)
static guint dissect_wlccp_tlvs( proto_tree *_tree, tvbuff_t *_tvb, guint _offset, guint _depth)
{
@@ -1993,6 +1994,7 @@ static guint dissect_wlccp_tlvs( proto_tree *_tree, tvbuff_t *_tvb, guint _offse
while (_offset < _tlv_end)
{
_old_offset = _offset;
+ // We recurse here, but we'll run out of packet before we run out of stack.
_offset = dissect_wlccp_tlvs(_tlv_tree, _tvb, _offset, _depth++);
DISSECTOR_ASSERT(_offset > _old_offset);
} /* while bytes_left >= 4*/
diff --git a/epan/dissectors/packet-wow.c b/epan/dissectors/packet-wow.c
index c6725341..80aa430d 100644
--- a/epan/dissectors/packet-wow.c
+++ b/epan/dissectors/packet-wow.c
@@ -460,7 +460,6 @@ parse_logon_reconnect_challenge_server_to_client(tvbuff_t *tvb, proto_tree *wow_
static void
parse_logon_challenge_client_to_server(packet_info *pinfo, tvbuff_t *tvb, proto_tree *wow_tree, guint32 offset) {
guint8 srp_i_len;
- char buffer[5];
gchar *string;
proto_tree_add_item(wow_tree, hf_wow_protocol_version, tvb,
@@ -471,10 +470,16 @@ parse_logon_challenge_client_to_server(packet_info *pinfo, tvbuff_t *tvb, proto_
tvb, offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
- tvb_get_raw_bytes_as_string(tvb, offset, buffer, 5);
- string = get_ascii_string(pinfo->pool, g_strreverse(buffer), 4);
+ string = tvb_get_string_enc(pinfo->pool, tvb, offset, 4, ENC_ASCII);
+ /* g_utf8_strreverse handles the REPLACMENT CHARACTERs.
+ * It would handle embedded NULs correctly if we passed in the
+ * byte length after conversion, but we need to change the API
+ * to use counted strings in more places.
+ */
+ string = g_utf8_strreverse(string, -1);
proto_tree_add_string(wow_tree, hf_wow_gamename,
tvb, offset, 4, string);
+ g_free(string);
offset += 4;
@@ -498,22 +503,25 @@ parse_logon_challenge_client_to_server(packet_info *pinfo, tvbuff_t *tvb, proto_
offset, 2, ENC_LITTLE_ENDIAN);
offset += 2;
- tvb_get_raw_bytes_as_string(tvb, offset, buffer, 5);
- string = get_ascii_string(pinfo->pool, g_strreverse(buffer), 4);
+ string = tvb_get_string_enc(pinfo->pool, tvb, offset, 4, ENC_ASCII);
+ string = g_utf8_strreverse(string, -1);
proto_tree_add_string(wow_tree, hf_wow_platform,
tvb, offset, 4, string);
+ g_free(string);
offset += 4;
- tvb_get_raw_bytes_as_string(tvb, offset, buffer, 5);
- string = get_ascii_string(pinfo->pool, g_strreverse(buffer), 4);
+ string = tvb_get_string_enc(pinfo->pool, tvb, offset, 4, ENC_ASCII);
+ string = g_utf8_strreverse(string, -1);
proto_tree_add_string(wow_tree, hf_wow_os, tvb,
offset, 4, string);
+ g_free(string);
offset += 4;
- tvb_get_raw_bytes_as_string(tvb, offset, buffer, 5);
- string = get_ascii_string(pinfo->pool, g_strreverse(buffer), 4);
+ string = tvb_get_string_enc(pinfo->pool, tvb, offset, 4, ENC_ASCII);
+ string = g_utf8_strreverse(string, -1);
proto_tree_add_string(wow_tree, hf_wow_country,
tvb, offset, 4, string);
+ g_free(string);
offset += 4;
proto_tree_add_item(wow_tree,
diff --git a/epan/dissectors/packet-wtp.c b/epan/dissectors/packet-wtp.c
index 5a46af12..bda20ab7 100644
--- a/epan/dissectors/packet-wtp.c
+++ b/epan/dissectors/packet-wtp.c
@@ -287,6 +287,7 @@ wtp_handle_tpi(proto_tree *tree, tvbuff_t *tvb)
/* Code to actually dissect the packets */
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_wtp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
char *szInfo;
@@ -359,6 +360,7 @@ dissect_wtp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
/* Skip the length field for the WTP sub-tvb */
wtp_tvb = tvb_new_subset_length(tvb, offCur + c_fieldlen, c_pdulen);
+ // We recurse here, but we'll run out of packet before we run out of stack.
dissect_wtp_common(wtp_tvb, pinfo, wtp_tree);
offCur += c_fieldlen + c_pdulen;
i++;
diff --git a/epan/dissectors/packet-x11.c b/epan/dissectors/packet-x11.c
index c4dcf9b4..1c520cde 100644
--- a/epan/dissectors/packet-x11.c
+++ b/epan/dissectors/packet-x11.c
@@ -3689,32 +3689,24 @@ static void dissect_x11_request(tvbuff_t *tvb, packet_info *pinfo,
case X_ConfigureWindow:
{
guint16 bitmask16;
- static int * const window_attributes_flags[] = {
- &hf_x11_window_value_mask_background_pixmap,
- &hf_x11_window_value_mask_background_pixel,
- &hf_x11_window_value_mask_border_pixmap,
- &hf_x11_window_value_mask_border_pixel,
- &hf_x11_window_value_mask_bit_gravity,
- &hf_x11_window_value_mask_win_gravity,
- &hf_x11_window_value_mask_backing_store,
- &hf_x11_window_value_mask_backing_planes,
- &hf_x11_window_value_mask_backing_pixel,
- &hf_x11_window_value_mask_override_redirect,
- &hf_x11_window_value_mask_save_under,
- &hf_x11_window_value_mask_event_mask,
- &hf_x11_window_value_mask_do_not_propagate_mask,
- &hf_x11_window_value_mask_colormap,
- &hf_x11_window_value_mask_cursor,
+ static int * const configure_window_mask_flags[] = {
+ &hf_x11_configure_window_mask_x,
+ &hf_x11_configure_window_mask_y,
+ &hf_x11_configure_window_mask_width,
+ &hf_x11_configure_window_mask_height,
+ &hf_x11_configure_window_mask_border_width,
+ &hf_x11_configure_window_mask_sibling,
+ &hf_x11_configure_window_mask_stack_mode,
NULL
};
proto_tree_add_item(t, hf_x11_unused, tvb, *offsetp, 1, ENC_NA);
*offsetp += 1;
requestLength(tvb, offsetp, t, byte_order);
- proto_tree_add_item(t, hf_x11_window, tvb, *offsetp, 1, byte_order);
+ proto_tree_add_item(t, hf_x11_window, tvb, *offsetp, 4, byte_order);
*offsetp += 4;
bitmask16 = tvb_get_guint16(tvb, *offsetp, byte_order);
- proto_tree_add_bitmask(t, tvb, *offsetp, hf_x11_configure_window_mask, ett_x11_configure_window_mask, window_attributes_flags, byte_order);
+ proto_tree_add_bitmask(t, tvb, *offsetp, hf_x11_configure_window_mask, ett_x11_configure_window_mask, configure_window_mask_flags, byte_order);
*offsetp += 2;
proto_tree_add_item(t, hf_x11_unused, tvb, *offsetp, 2, ENC_NA);
*offsetp += 2;
diff --git a/epan/dissectors/packet-x509if.c b/epan/dissectors/packet-x509if.c
index 31cf56d7..25bed90c 100644
--- a/epan/dissectors/packet-x509if.c
+++ b/epan/dissectors/packet-x509if.c
@@ -316,7 +316,6 @@ x509if_frame_end(void)
/*int dissect_x509if_AttributeCombination(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);*/
-#define MAX_RECURSION_DEPTH 100 // Arbitrarily chosen.
static int
@@ -1048,16 +1047,15 @@ static const ber_choice_t Refinement_choice[] = {
int
dissect_x509if_Refinement(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 3;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // Refinement → Refinement/and → Refinement
+ actx->pinfo->dissection_depth += 2;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_choice(actx, tree, tvb, offset,
Refinement_choice, hf_index, ett_x509if_Refinement,
NULL);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 2;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
@@ -1493,16 +1491,15 @@ static const ber_choice_t ContextCombination_choice[] = {
int
dissect_x509if_ContextCombination(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 3;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // ContextCombination → ContextCombination/and → ContextCombination
+ actx->pinfo->dissection_depth += 2;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_choice(actx, tree, tvb, offset,
ContextCombination_choice, hf_index, ett_x509if_ContextCombination,
NULL);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 2;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
@@ -1618,16 +1615,15 @@ static const ber_choice_t AttributeCombination_choice[] = {
int
dissect_x509if_AttributeCombination(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 3;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // AttributeCombination → AttributeCombination/and → AttributeCombination
+ actx->pinfo->dissection_depth += 2;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_choice(actx, tree, tvb, offset,
AttributeCombination_choice, hf_index, ett_x509if_AttributeCombination,
NULL);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 2;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
diff --git a/epan/dissectors/packet-x509sat.c b/epan/dissectors/packet-x509sat.c
index 6704d950..260e1d5f 100644
--- a/epan/dissectors/packet-x509sat.c
+++ b/epan/dissectors/packet-x509sat.c
@@ -258,7 +258,6 @@ static gint ett_x509sat_LocaleContextSyntax = -1;
/*int dissect_x509sat_Criteria(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);*/
-#define MAX_RECURSION_DEPTH 100 // Arbitrarily chosen.
static int
@@ -433,16 +432,15 @@ static const ber_choice_t Criteria_choice[] = {
int
dissect_x509sat_Criteria(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 3;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // Criteria → Criteria/and → Criteria
+ actx->pinfo->dissection_depth += 2;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_choice(actx, tree, tvb, offset,
Criteria_choice, hf_index, ett_x509sat_Criteria,
NULL);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 2;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
diff --git a/epan/dissectors/packet-x75.c b/epan/dissectors/packet-x75.c
index 82386795..df491b5c 100644
--- a/epan/dissectors/packet-x75.c
+++ b/epan/dissectors/packet-x75.c
@@ -232,8 +232,6 @@ void
proto_reg_handoff_x75(void)
{
data_handle = find_dissector("data");
-
- dissector_add_uint("wtap_encap", WTAP_ENCAP_LAPB, x75_handle);
}
/*
diff --git a/epan/dissectors/packet-xml.c b/epan/dissectors/packet-xml.c
index a2edca83..e7a7a960 100644
--- a/epan/dissectors/packet-xml.c
+++ b/epan/dissectors/packet-xml.c
@@ -1119,6 +1119,7 @@ static gchar *fully_qualified_name(GPtrArray *hier, gchar *name, gchar *proto_na
}
+// NOLINTNEXTLINE(misc-no-recursion)
static xml_ns_t *make_xml_hier(gchar *elem_name,
xml_ns_t *root,
wmem_map_t *elements,
@@ -1145,6 +1146,11 @@ static xml_ns_t *make_xml_hier(gchar *elem_name,
return NULL;
}
+ if (hier->len >= prefs.gui_max_tree_depth) {
+ g_string_append_printf(error, "hierarchy too deep: %u\n", hier->len);
+ return NULL;
+ }
+
for (i = 0; i < hier->len; i++) {
if( (elem_name) && (strcmp(elem_name, (gchar *) g_ptr_array_index(hier, i) ) == 0 )) {
recurred = TRUE;
diff --git a/epan/dissectors/packet-xmpp-utils.c b/epan/dissectors/packet-xmpp-utils.c
index 1f095a76..d8c6cf2c 100644
--- a/epan/dissectors/packet-xmpp-utils.c
+++ b/epan/dissectors/packet-xmpp-utils.c
@@ -189,6 +189,7 @@ xmpp_ibb_session_track(packet_info *pinfo, xmpp_element_t *packet, xmpp_conv_inf
}
static void
+// NOLINTNEXTLINE(misc-no-recursion)
xmpp_unknown_items(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element, guint level)
{
GList *childs = element->elements;
@@ -522,10 +523,11 @@ xmpp_element_t_cleanup(void* userdata)
Function converts xml_frame_t structure to xmpp_element_t (simpler representation)
*/
xmpp_element_t*
-xmpp_xml_frame_to_element_t(wmem_allocator_t *pool, xml_frame_t *xml_frame, xmpp_element_t *parent, tvbuff_t *tvb)
+// NOLINTNEXTLINE(misc-no-recursion)
+xmpp_xml_frame_to_element_t(packet_info *pinfo, xml_frame_t *xml_frame, xmpp_element_t *parent, tvbuff_t *tvb)
{
xml_frame_t *child;
- xmpp_element_t *node = wmem_new0(pool, xmpp_element_t);
+ xmpp_element_t *node = wmem_new0(pinfo->pool, xmpp_element_t);
tvbparse_t* tt;
tvbparse_elem_t* elem;
@@ -536,7 +538,7 @@ xmpp_xml_frame_to_element_t(wmem_allocator_t *pool, xml_frame_t *xml_frame, xmpp
node->was_read = FALSE;
node->default_ns_abbrev = NULL;
- node->name = wmem_strdup(pool, xml_frame->name_orig_case);
+ node->name = wmem_strdup(pinfo->pool, xml_frame->name_orig_case);
node->offset = 0;
node->length = 0;
@@ -558,11 +560,11 @@ xmpp_xml_frame_to_element_t(wmem_allocator_t *pool, xml_frame_t *xml_frame, xmpp
*/
CLEANUP_PUSH(xmpp_element_t_cleanup, node);
- tt = tvbparse_init(pool, tvb,node->offset,-1,NULL,want_ignore);
+ tt = tvbparse_init(pinfo->pool, tvb,node->offset,-1,NULL,want_ignore);
if((elem = tvbparse_get(tt,want_stream_end_with_ns))!=NULL)
{
- node->default_ns_abbrev = tvb_get_string_enc(pool, elem->sub->tvb, elem->sub->offset, elem->sub->len, ENC_ASCII);
+ node->default_ns_abbrev = tvb_get_string_enc(pinfo->pool, elem->sub->tvb, elem->sub->offset, elem->sub->len, ENC_ASCII);
}
child = xml_frame->first_child;
@@ -577,21 +579,21 @@ xmpp_xml_frame_to_element_t(wmem_allocator_t *pool, xml_frame_t *xml_frame, xmpp
gchar *value = NULL;
const gchar *xmlns_needle = NULL;
- xmpp_attr_t *attr = wmem_new(pool, xmpp_attr_t);
+ xmpp_attr_t *attr = wmem_new(pinfo->pool, xmpp_attr_t);
attr->length = 0;
attr->offset = 0;
attr->was_read = FALSE;
if (child->value != NULL) {
l = tvb_reported_length(child->value);
- value = (gchar *)wmem_alloc0(pool, l + 1);
+ value = (gchar *)wmem_alloc0(pinfo->pool, l + 1);
tvb_memcpy(child->value, value, 0, l);
}
attr->offset = child->start_offset;
attr->length = child->length;
attr->value = value;
- attr->name = wmem_strdup(pool, child->name_orig_case);
+ attr->name = wmem_strdup(pinfo->pool, child->name_orig_case);
g_hash_table_insert(node->attrs,(gpointer)attr->name,(gpointer)attr);
@@ -602,10 +604,10 @@ xmpp_xml_frame_to_element_t(wmem_allocator_t *pool, xml_frame_t *xml_frame, xmpp
{
if(attr->name[5] == ':' && strlen(attr->name) > 6)
{
- g_hash_table_insert(node->namespaces, (gpointer)wmem_strdup(pool, &attr->name[6]), (gpointer)wmem_strdup(pool, attr->value));
+ g_hash_table_insert(node->namespaces, (gpointer)wmem_strdup(pinfo->pool, &attr->name[6]), (gpointer)wmem_strdup(pinfo->pool, attr->value));
} else if(attr->name[5] == '\0')
{
- g_hash_table_insert(node->namespaces, (gpointer)"", (gpointer)wmem_strdup(pool, attr->value));
+ g_hash_table_insert(node->namespaces, (gpointer)"", (gpointer)wmem_strdup(pinfo->pool, attr->value));
}
}
@@ -617,13 +619,13 @@ xmpp_xml_frame_to_element_t(wmem_allocator_t *pool, xml_frame_t *xml_frame, xmpp
gint l;
gchar* value = NULL;
- data = wmem_new(pool, xmpp_data_t);
+ data = wmem_new(pinfo->pool, xmpp_data_t);
data->length = 0;
data->offset = 0;
if (child->value != NULL) {
l = tvb_reported_length(child->value);
- value = (gchar *)wmem_alloc0(pool, l + 1);
+ value = (gchar *)wmem_alloc0(pinfo->pool, l + 1);
tvb_memcpy(child->value, value, 0, l);
}
@@ -635,7 +637,9 @@ xmpp_xml_frame_to_element_t(wmem_allocator_t *pool, xml_frame_t *xml_frame, xmpp
}
} else
{
- node->elements = g_list_append(node->elements,(gpointer)xmpp_xml_frame_to_element_t(pool, child, node,tvb));
+ increment_dissection_depth(pinfo);
+ node->elements = g_list_append(node->elements,(gpointer)xmpp_xml_frame_to_element_t(pinfo, child, node,tvb));
+ decrement_dissection_depth(pinfo);
}
child = child->next_sibling;
@@ -647,6 +651,7 @@ xmpp_xml_frame_to_element_t(wmem_allocator_t *pool, xml_frame_t *xml_frame, xmpp
}
void
+// NOLINTNEXTLINE(misc-no-recursion)
xmpp_element_t_tree_free(xmpp_element_t *root)
{
GList *childs = root->elements;
@@ -658,6 +663,7 @@ xmpp_element_t_tree_free(xmpp_element_t *root)
{
xmpp_element_t *child = (xmpp_element_t *)childs->data;
+ // Our depth should be limited by the check in xmpp_xml_frame_to_element_t
xmpp_element_t_tree_free(child);
childs = childs->next;
}
diff --git a/epan/dissectors/packet-xmpp-utils.h b/epan/dissectors/packet-xmpp-utils.h
index 34214086..cf54f9f5 100644
--- a/epan/dissectors/packet-xmpp-utils.h
+++ b/epan/dissectors/packet-xmpp-utils.h
@@ -158,7 +158,7 @@ extern void xmpp_simple_cdata_elem(proto_tree *tree, tvbuff_t *tvb, packet_info
/** Converts xml_frame_t struct to xmpp_element_t. Should be call with parent==NULL.
*/
-extern xmpp_element_t* xmpp_xml_frame_to_element_t(wmem_allocator_t *pool, xml_frame_t *xml_frame, xmpp_element_t *parent, tvbuff_t *tvb);
+extern xmpp_element_t* xmpp_xml_frame_to_element_t(packet_info *pinfo, xml_frame_t *xml_frame, xmpp_element_t *parent, tvbuff_t *tvb);
/** Frees all GLib structs in xmpp_element_t struct. Should be call only for root element.
* It works recursively.
diff --git a/epan/dissectors/packet-xmpp.c b/epan/dissectors/packet-xmpp.c
index 08cd1748..7bc9bd47 100644
--- a/epan/dissectors/packet-xmpp.c
+++ b/epan/dissectors/packet-xmpp.c
@@ -479,7 +479,7 @@ dissect_xmpp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
while(xml_frame)
{
- packet = xmpp_xml_frame_to_element_t(pinfo->pool, xml_frame, NULL, tvb);
+ packet = xmpp_xml_frame_to_element_t(pinfo, xml_frame, NULL, tvb);
DISSECTOR_ASSERT(packet);
CLEANUP_PUSH(cleanup_xmpp, packet);
diff --git a/epan/dissectors/packet-yami.c b/epan/dissectors/packet-yami.c
index eaa2e757..539350df 100644
--- a/epan/dissectors/packet-yami.c
+++ b/epan/dissectors/packet-yami.c
@@ -83,6 +83,7 @@ static int ett_yami_msg_data = -1;
static int ett_yami_param = -1;
static int
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_yami_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_item *par_ti)
{
const int orig_offset = offset;
@@ -364,7 +365,9 @@ dissect_yami_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
proto_item_append_text(ti, ", Type: nested, %u parameters: ", count);
for (i = 0; i < count; i++) {
+ increment_dissection_depth(pinfo);
offset = dissect_yami_parameter(tvb, pinfo, yami_param, offset, ti);
+ decrement_dissection_depth(pinfo);
/* smth went wrong */
if (offset == -1)
return -1;
diff --git a/epan/dissectors/packet-z3950.c b/epan/dissectors/packet-z3950.c
index dda2a489..417481f1 100644
--- a/epan/dissectors/packet-z3950.c
+++ b/epan/dissectors/packet-z3950.c
@@ -2070,7 +2070,6 @@ static int dissect_z3950_ElementInfo(bool implicit_tag _U_, tvbuff_t *tvb _U_, i
static int dissect_z3950_TaggedElement(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_);
-#define MAX_RECURSION_DEPTH 100 // Arbitrarily chosen.
static int
@@ -3032,16 +3031,15 @@ static const ber_choice_t RPNStructure_choice[] = {
static int
dissect_z3950_RPNStructure(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 3;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // RPNStructure → RPNStructure/rpnRpnOp → RPNStructure
+ actx->pinfo->dissection_depth += 2;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_choice(actx, tree, tvb, offset,
RPNStructure_choice, hf_index, ett_z3950_RPNStructure,
NULL);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 2;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
@@ -6543,15 +6541,14 @@ static const ber_sequence_t ElementInfo_sequence[] = {
static int
dissect_z3950_ElementInfo(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 4;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // ElementInfo → ElementDataType → ElementDataType/structured → ElementInfo
+ actx->pinfo->dissection_depth += 3;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
ElementInfo_sequence, hf_index, ett_z3950_ElementInfo);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 3;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
@@ -8024,15 +8021,14 @@ static const ber_sequence_t TaggedElement_sequence[] = {
static int
dissect_z3950_TaggedElement(bool implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) {
- const int proto_id = GPOINTER_TO_INT(wmem_list_frame_data(wmem_list_tail(actx->pinfo->layers)));
- const unsigned cycle_size = 4;
- unsigned recursion_depth = p_get_proto_depth(actx->pinfo, proto_id);
- DISSECTOR_ASSERT(recursion_depth <= MAX_RECURSION_DEPTH);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth + cycle_size);
+ // TaggedElement → ElementData → ElementData/subtree → TaggedElement
+ actx->pinfo->dissection_depth += 3;
+ increment_dissection_depth(actx->pinfo);
offset = dissect_ber_sequence(implicit_tag, actx, tree, tvb, offset,
TaggedElement_sequence, hf_index, ett_z3950_TaggedElement);
- p_set_proto_depth(actx->pinfo, proto_id, recursion_depth - cycle_size);
+ actx->pinfo->dissection_depth -= 3;
+ decrement_dissection_depth(actx->pinfo);
return offset;
}
diff --git a/epan/dissectors/packet-zbee-nwk-gp.c b/epan/dissectors/packet-zbee-nwk-gp.c
index 5d6e8276..25dc8e03 100644
--- a/epan/dissectors/packet-zbee-nwk-gp.c
+++ b/epan/dissectors/packet-zbee-nwk-gp.c
@@ -1502,8 +1502,11 @@ static guint
dissect_zbee_nwk_gp_cmd_move_up_down(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
zbee_nwk_green_power_packet *packet _U_, guint offset)
{
- proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_move_up_down_rate, tvb, offset, 1, ENC_LITTLE_ENDIAN);
- offset += 1;
+ /* Optional rate field. */
+ if (tvb_reported_length(tvb) - offset >= 1) {
+ proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_move_up_down_rate, tvb, offset, 1, ENC_LITTLE_ENDIAN);
+ offset += 1;
+ }
return offset;
} /* dissect_zbee_nwk_gp_cmd_move_up_down */
@@ -1549,8 +1552,11 @@ dissect_zbee_nwk_gp_cmd_step_up_down(tvbuff_t *tvb, packet_info *pinfo _U_, prot
{
proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_step_up_down_step_size, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
- proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_step_up_down_transition_time, tvb, offset, 2, ENC_LITTLE_ENDIAN);
- offset += 2;
+ /* Optional time field. */
+ if (tvb_reported_length(tvb) - offset >= 2) {
+ proto_tree_add_item(tree, hf_zbee_nwk_gp_cmd_step_up_down_transition_time, tvb, offset, 2, ENC_LITTLE_ENDIAN);
+ offset += 2;
+ }
return offset;
} /* dissect_zbee_nwk_gp_cmd_step_up_down */
diff --git a/epan/dissectors/packet-zbee-zcl.c b/epan/dissectors/packet-zbee-zcl.c
index f9bd5f64..a4a11e4f 100644
--- a/epan/dissectors/packet-zbee-zcl.c
+++ b/epan/dissectors/packet-zbee-zcl.c
@@ -1991,6 +1991,7 @@ static void dissect_zcl_attr_data_general(tvbuff_t *tvb, proto_tree *tree, guint
*@param offset into the tvb to begin dissection.
*@param client_attr ZCL client
*/
+// NOLINTNEXTLINE(misc-no-recursion)
void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset, guint data_type, gboolean client_attr)
{
guint attr_uint;
@@ -2004,6 +2005,7 @@ void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset, guint
nstime_t attr_time;
/* Dissect attribute data type and data */
+ // We can recurse here, but we should run out of packet before we run out of stack.
switch ( data_type ) {
case ZBEE_ZCL_NO_DATA:
break;
@@ -2416,6 +2418,7 @@ guint dissect_zcl_attr_uint8(tvbuff_t *tvb, proto_tree *tree, guint *offset, int
*@param client_attr ZCL client
*/
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_zcl_array_type(tvbuff_t *tvb, proto_tree *tree, guint *offset, guint8 elements_type, guint16 elements_num, gboolean client_attr)
{
proto_tree *sub_tree;
@@ -2457,6 +2460,7 @@ dissect_zcl_array_type(tvbuff_t *tvb, proto_tree *tree, guint *offset, guint8 el
*@param client_attr ZCL client
*/
static void
+// NOLINTNEXTLINE(misc-no-recursion)
dissect_zcl_set_type(tvbuff_t *tvb, proto_tree *tree, guint *offset, guint8 elements_type, guint16 elements_num, gboolean client_attr)
{
proto_tree *sub_tree;
diff --git a/epan/dissectors/usb.c b/epan/dissectors/usb.c
index 0c2283f4..1f830e38 100644
--- a/epan/dissectors/usb.c
+++ b/epan/dissectors/usb.c
@@ -37,6 +37,7 @@ static const value_string usb_vendors_vals[] = {
{ 0x0003, "Club Mac" },
{ 0x0004, "Nebraska Furniture Mart" },
{ 0x0011, "Unknown" },
+ { 0x001f, "Walmart" },
{ 0x0040, "Anyware Corporation" },
{ 0x0042, "DMT" },
{ 0x0053, "Planex" },
@@ -1226,6 +1227,7 @@ static const value_string usb_vendors_vals[] = {
{ 0x0a2c, "AK-Modul-Bus Computer GmbH" },
{ 0x0a34, "TG3 Electronics, Inc." },
{ 0x0a35, "Radikal Technologies" },
+ { 0x0a38, "IRIS sa" },
{ 0x0a39, "Gilat Satellite Networks, Ltd" },
{ 0x0a3a, "PentaMedia Co., Ltd" },
{ 0x0a3c, "NTT DoCoMo, Inc." },
@@ -3463,6 +3465,7 @@ static const value_string usb_products_vals[] = {
{ 0x00020002, "passport00" },
{ 0x00027007, "HPRT XT300" },
{ 0x00117788, "counterfeit flash drive" },
+ { 0x001f0b21, "AB13X Headset Adapter" },
{ 0x0040073d, "Mini Multimedia 2.4GHz Wireless Keyboard with Touch Pad" },
{ 0x00535301, "GW-US54ZGL 802.11bg" },
{ 0x00780006, "Joystick" },
@@ -3608,6 +3611,7 @@ static const value_string usb_products_vals[] = {
{ 0x03f00012, "DeskJet 1125C Printer Port" },
{ 0x03f00024, "KU-0316 Keyboard" },
{ 0x03f0002a, "LaserJet P1102" },
+ { 0x03f00036, "CCID Smartcard Keyboard KUS0133" },
{ 0x03f00053, "DeskJet 2620 All-in-One Printer" },
{ 0x03f00101, "ScanJet 4100c" },
{ 0x03f00102, "PhotoSmart S20" },
@@ -4175,9 +4179,9 @@ static const value_string usb_products_vals[] = {
{ 0x03f3008c, "AVC-2310 Device" },
{ 0x03f30094, "eHome Infrared Receiver" },
{ 0x03f3009b, "AVC-1410 GameBridge TV NTSC" },
- { 0x03f32000, "USBXchange" },
+ { 0x03f32000, "USBXchange Firmware Loader" },
{ 0x03f32001, "USBXchange Adapter" },
- { 0x03f32002, "USB2-Xchange" },
+ { 0x03f32002, "USB2-Xchange Firmware Loader" },
{ 0x03f32003, "USB2-Xchange Adapter" },
{ 0x03f34000, "4-port hub" },
{ 0x03f3adcc, "Composite Device Support" },
@@ -4233,6 +4237,9 @@ static const value_string usb_products_vals[] = {
{ 0x0403601f, "FT601 32-bit FIFO IC" },
{ 0x04036ee0, "EZO Carrier Board" },
{ 0x04036f70, "HB-RF-USB" },
+ { 0x04037150, "FT2232x wired for MPSSE+UART" },
+ { 0x04037151, "FT2232x wired for MPSSE+UART" },
+ { 0x04037152, "FreeCalypso dual UART with boot control" },
{ 0x04037be8, "FT232R" },
{ 0x04038028, "Dev board JTAG (FT232H based)" },
{ 0x04038040, "4 Port Hub" },
@@ -5176,6 +5183,7 @@ static const value_string usb_products_vals[] = {
{ 0x04243fcc, "RME MADIface" },
{ 0x04244041, "Hub and media card controller" },
{ 0x04244060, "Ultra Fast Media Reader" },
+ { 0x04244063, "xD/SD/MS/MMC Reader" },
{ 0x04244064, "Ultra Fast Media Reader" },
{ 0x04244712, "USB4712 high-speed hub" },
{ 0x04244713, "USB4715 high-speed hub (2 ports disabled)" },
@@ -5411,6 +5419,8 @@ static const value_string usb_products_vals[] = {
{ 0x043e9800, "Remote Control Receiver_iMON" },
{ 0x043e9803, "eHome Infrared Receiver" },
{ 0x043e9804, "DMB Receiver Control" },
+ { 0x043e9a10, "34UC88-B" },
+ { 0x043e9a11, "34UC88-B" },
{ 0x043e9a39, "27UP850 - WK.AEUDCSN - External Monitor 4K" },
{ 0x043e9c01, "LGE Sync" },
{ 0x04411456, "Hub" },
@@ -5803,6 +5813,8 @@ static const value_string usb_products_vals[] = {
{ 0x045e02e6, "Xbox Wireless Adapter for Windows" },
{ 0x045e02ea, "Xbox One Controller" },
{ 0x045e02fd, "Xbox One S Controller [Bluetooth]" },
+ { 0x045e02fe, "Xbox Wireless Adapter for Windows" },
+ { 0x045e0306, "Surface Pro 7 SD Card Reader" },
{ 0x045e0400, "Windows Powered Pocket PC 2002" },
{ 0x045e0401, "Windows Powered Pocket PC 2002" },
{ 0x045e0402, "Windows Powered Pocket PC 2002" },
@@ -5980,6 +5992,7 @@ static const value_string usb_products_vals[] = {
{ 0x045e0800, "Wireless keyboard (All-in-One-Media)" },
{ 0x045e0810, "LifeCam HD-3000" },
{ 0x045e0823, "Classic IntelliMouse" },
+ { 0x045e082a, "Pro Intellimouse" },
{ 0x045e0900, "Surface Dock Hub" },
{ 0x045e0901, "Surface Dock Hub" },
{ 0x045e0902, "Surface Dock Hub" },
@@ -6535,10 +6548,10 @@ static const value_string usb_products_vals[] = {
{ 0x046dc52b, "Unifying Receiver" },
{ 0x046dc52d, "R700 Remote Presenter receiver" },
{ 0x046dc52e, "MK260 Wireless Combo Receiver" },
- { 0x046dc52f, "Unifying Receiver" },
+ { 0x046dc52f, "Nano Receiver" },
{ 0x046dc531, "C-U0007 [Unifying Receiver]" },
{ 0x046dc532, "Unifying Receiver" },
- { 0x046dc534, "Unifying Receiver" },
+ { 0x046dc534, "Nano Receiver" },
{ 0x046dc537, "Cordless Mouse Receiver" },
{ 0x046dc539, "Lightspeed Receiver" },
{ 0x046dc53a, "PowerPlay Wireless Charging System" },
@@ -6942,6 +6955,7 @@ static const value_string usb_products_vals[] = {
{ 0x04835720, "Mass Storage Device" },
{ 0x04835721, "Interrupt Demo" },
{ 0x04835722, "Bulk Demo" },
+ { 0x0483572a, "STM32F401 microcontroller [ARM Cortex M4] [CDC/ACM serial port]" },
{ 0x04835730, "Audio Speaker" },
{ 0x04835731, "Microphone" },
{ 0x04835740, "Virtual COM Port" },
@@ -6980,7 +6994,7 @@ static const value_string usb_products_vals[] = {
{ 0x0489e07a, "Broadcom BCM20702A1 Bluetooth" },
{ 0x0489e0c8, "MediaTek MT7921 Bluetooth" },
{ 0x0489e0cd, "MediaTek Bluetooth Adapter" },
- { 0x0489e0d8, "Bluetooth Adapter" },
+ { 0x0489e0d8, "Bluetooth 5.2 Adapter [MediaTek MT7922]" },
{ 0x0489e111, "Foxconn (for Lenovo) IdeaTab A2109/A2110/Medion LIFETAB S9714" },
{ 0x048d1165, "IT1165 Flash Controller" },
{ 0x048d1172, "Flash Drive" },
@@ -8538,6 +8552,11 @@ static const value_string usb_products_vals[] = {
{ 0x04bf0320, "Bluetooth Adapter" },
{ 0x04bf0321, "Bluetooth Device" },
{ 0x04bf0a28, "INDI AV-IN Device" },
+ { 0x04bf1301, "Network Controller" },
+ { 0x04bf1302, "i3 Gateway" },
+ { 0x04bf1303, "3 Micro Module" },
+ { 0x04bf1304, "i3 Module" },
+ { 0x04bf1305, "i3 Multi Sensing Module" },
{ 0x04c10020, "56K Voice Pro" },
{ 0x04c10022, "56K Voice Pro" },
{ 0x04c1007e, "ISDN TA" },
@@ -8590,6 +8609,7 @@ static const value_string usb_products_vals[] = {
{ 0x04c8072c, "Revio KD20M" },
{ 0x04c8072d, "Revio KD410Z" },
{ 0x04ca0020, "USB Keyboard" },
+ { 0x04ca003a, "Multimedia Keyboard" },
{ 0x04ca004b, "Keyboard" },
{ 0x04ca004f, "SK-9020 keyboard" },
{ 0x04ca008a, "Acer Wired Mouse Model SM-9023" },
@@ -8763,6 +8783,7 @@ static const value_string usb_products_vals[] = {
{ 0x04cb02f0, "Fuji Fujifilm X-H2S" },
{ 0x04cb02f2, "Fuji Fujifilm X-H2" },
{ 0x04cb02fc, "Fuji Fujifilm X-T5" },
+ { 0x04cb0305, "Fuji Fujifilm X100VI" },
{ 0x04cb5006, "ASK-300" },
{ 0x04cb5007, "DX100" },
{ 0x04cc1122, "Hub" },
@@ -8857,6 +8878,7 @@ static const value_string usb_products_vals[] = {
{ 0x04d91400, "PS/2 keyboard + mouse controller" },
{ 0x04d91503, "Keyboard" },
{ 0x04d91603, "Keyboard" },
+ { 0x04d91605, "Keyboard" },
{ 0x04d91702, "Keyboard LKS02" },
{ 0x04d91818, "Keyboard [Diatec Filco Majestouch 2]" },
{ 0x04d92011, "Keyboard [Diatec Filco Majestouch 1]" },
@@ -9470,6 +9492,7 @@ static const value_string usb_products_vals[] = {
{ 0x04f2b681, "ThinkPad T490 Webcam" },
{ 0x04f2b71a, "Integrated IR Camera" },
{ 0x04f2b76b, "SunplusIT Inc [HP HD Camera]" },
+ { 0x04f2b7b4, "Integrated Camera (1920x1080)" },
{ 0x04f3000a, "Touchscreen" },
{ 0x04f30103, "ActiveJet K-2024 Multimedia Keyboard" },
{ 0x04f3016f, "Touchscreen" },
@@ -10081,6 +10104,8 @@ static const value_string usb_products_vals[] = {
{ 0x04fcffff, "PureDigital Ritz Disposable" },
{ 0x04fd0003, "Smart Card Reader II" },
{ 0x04fe0006, "Happy Hacking Keyboard Lite2" },
+ { 0x04fe0020, "HHKB-Classic" },
+ { 0x04fe0021, "Happy Hacking Keyboard Professional HYBRID Type-S" },
{ 0x05000001, "DART Keyboard Mouse" },
{ 0x05000002, "DART-2 Keyboard" },
{ 0x05020001, "Handheld" },
@@ -10175,6 +10200,7 @@ static const value_string usb_products_vals[] = {
{ 0x050d0081, "F8T001v2 Bluetooth" },
{ 0x050d0083, "Bluetooth Device" },
{ 0x050d0084, "F8T003v2 Bluetooth" },
+ { 0x050d008a, "6-in-1 Multiport Adapter" },
{ 0x050d0102, "Flip KVM" },
{ 0x050d0103, "F5U103 Serial Adapter [etek]" },
{ 0x050d0106, "VideoBus II Adapter, Video" },
@@ -10620,6 +10646,7 @@ static const value_string usb_products_vals[] = {
{ 0x054c0568, "DSC-H100 in Mass Storage mode" },
{ 0x054c0574, "Sony SLT-A65V" },
{ 0x054c0577, "Sony SLT-A77V" },
+ { 0x054c0579, "Sony NEX-5N" },
{ 0x054c057d, "Sony NEX-7" },
{ 0x054c059a, "Sony NWZ-B163F" },
{ 0x054c05a6, "Sony NWZ-E464" },
@@ -10637,6 +10664,7 @@ static const value_string usb_products_vals[] = {
{ 0x054c0675, "Sony SLT-A99v" },
{ 0x054c0678, "Sony NEX-6" },
{ 0x054c0689, "Sony NWZ-B173F" },
+ { 0x054c068c, "UP-D711" },
{ 0x054c06a9, "Sony NWZ-E474" },
{ 0x054c06ac, "Sony Xperia Tablet S - SGPT12" },
{ 0x054c06bb, "WALKMAN NWZ-F805" },
@@ -11075,10 +11103,17 @@ static const value_string usb_products_vals[] = {
{ 0x056a03ac, "DTH-W1620 [MobileStudio Pro 16] touchscreen" },
{ 0x056a03b2, "DTH167 [Cintiq Pro 16] tablet" },
{ 0x056a03b3, "DTH167 [Cintiq Pro 16] touchscreen" },
+ { 0x056a03c0, "DTH271 [Cintiq Pro 27] touchscreen" },
+ { 0x056a03c4, "DTH172 [Cintiq Pro 17]" },
{ 0x056a03c5, "CTL-4100WL [Intuos BT (S)]" },
{ 0x056a03c7, "CTL-6100WL [Intuos BT (M)]" },
+ { 0x056a03cb, "DTH134 [Wacom One 13] touchscreen" },
+ { 0x056a03ce, "DTC121 [Wacom One 12] touchscreen" },
+ { 0x056a03d0, "DTH227 [Cintiq Pro 22]" },
{ 0x056a03dc, "PTH-460 [Intuos Pro (S)] tablet" },
{ 0x056a03dd, "PTH-460 [Intuos Pro BT (S)] tablet" },
+ { 0x056a03ec, "DTH134 [DTH134] touchscreen" },
+ { 0x056a03ed, "DTC121 [DTC121] touchscreen" },
{ 0x056a0400, "PenPartner 4x5" },
{ 0x056a4001, "TPC4001" },
{ 0x056a4004, "TPC4004" },
@@ -11095,19 +11130,22 @@ static const value_string usb_products_vals[] = {
{ 0x056d0002, "HID Monitor Controls" },
{ 0x056d0003, "Device Bay Controller" },
{ 0x056d4000, "FlexScan EV3237" },
- { 0x056d4001, "Monitor" },
- { 0x056d4002, "USB HID Monitor" },
+ { 0x056d4001, "FlexScan EV2450" },
+ { 0x056d4002, "FlexScan EV2455" },
{ 0x056d4014, "FlexScan EV2750" },
{ 0x056d4026, "FlexScan EV2451" },
{ 0x056d4027, "FlexScan EV2456" },
+ { 0x056d402b, "FlexScan EV2780" },
{ 0x056d4036, "FlexScan EV2785" },
{ 0x056d4037, "FlexScan EV3285" },
{ 0x056d4044, "FlexScan EV2457" },
{ 0x056d4059, "FlexScan EV2760" },
{ 0x056d405a, "FlexScan EV2360" },
{ 0x056d405b, "FlexScan EV2460" },
+ { 0x056d405e, "FlexScan EV2495" },
{ 0x056d405f, "FlexScan EV2795" },
{ 0x056d4065, "FlexScan EV3895" },
+ { 0x056d406a, "FlexScan EV2480" },
{ 0x056e0002, "29UO Mouse" },
{ 0x056e0057, "Micro Grast Pop M-PGDL" },
{ 0x056e005c, "Micro Grast Pop M-PG2DL" },
@@ -11831,6 +11869,7 @@ static const value_string usb_products_vals[] = {
{ 0x059f1093, "Rugged" },
{ 0x059f1094, "Rugged THB" },
{ 0x059f1095, "Rugged" },
+ { 0x059f1105, "Mobile Drive (RLSD: 2022)" },
{ 0x059fa601, "HardDrive" },
{ 0x059fa602, "CD R/W" },
{ 0x05a38388, "Marvell 88W8388 802.11a/b/g WLAN" },
@@ -12595,6 +12634,7 @@ static const value_string usb_products_vals[] = {
{ 0x05e3f12a, "Digital Microscope" },
{ 0x05e3fd21, "3M TL20 Temperature Logger" },
{ 0x05e3fe00, "Razer Mouse" },
+ { 0x05e63390, "3390 Arbitrary Waveform Generator" },
{ 0x05e90008, "KL5KUSB101B Ethernet [klsi]" },
{ 0x05e90009, "Sony 10Mbps Ethernet [pegasus]" },
{ 0x05e9000c, "USB-to-RS-232" },
@@ -12744,6 +12784,8 @@ static const value_string usb_products_vals[] = {
{ 0x06380a41, "Avision AM3000/MF3000 Series" },
{ 0x06380f01, "fi-4010CU" },
{ 0x06384004, "Minolta Dimage Scan Elite II AF-2920 (2888)" },
+ { 0x06397213, "CH7213" },
+ { 0x06397231, "CH7213" },
{ 0x06400026, "LPC-Stick" },
{ 0x06440000, "Floppy" },
{ 0x06440200, "All-In-One Multi-Card Reader CA200/B/S" },
@@ -13382,6 +13424,7 @@ static const value_string usb_products_vals[] = {
{ 0x06cb00bd, "Prometheus MIS Touch Fingerprint Reader" },
{ 0x06cb00c7, "TouchPad" },
{ 0x06cb00cb, "Fingerprint scanner" },
+ { 0x06cb00fc, "Prometheus Fingerprint Reader" },
{ 0x06cb0ac3, "Large Touch Screen" },
{ 0x06cb2970, "touchpad" },
{ 0x06cc0101, "Cable Modem" },
@@ -13436,7 +13479,9 @@ static const value_string usb_products_vals[] = {
{ 0x06d3038c, "CP900DW(ID) Port" },
{ 0x06d30393, "CP9500D/DW Port" },
{ 0x06d30394, "CP9000D/DW Port" },
+ { 0x06d30395, "CP9000DW" },
{ 0x06d30398, "P93D" },
+ { 0x06d3039e, "CP9500DW-S" },
{ 0x06d303a1, "CP9550D/DW Port" },
{ 0x06d303a5, "CP9550DW-S" },
{ 0x06d303a9, "CP-9600DW" },
@@ -13447,7 +13492,9 @@ static const value_string usb_products_vals[] = {
{ 0x06d30f10, "Hori/Namco FlightStick 2" },
{ 0x06d321ba, "FOMA D905i" },
{ 0x06d33b10, "P95D" },
+ { 0x06d33b20, "CP9820DW Series" },
{ 0x06d33b21, "CP-9810D/DW" },
+ { 0x06d33b2f, "LS9820A" },
{ 0x06d33b30, "CP-D70DW / CP-D707DW" },
{ 0x06d33b31, "CP-K60DW-S" },
{ 0x06d33b36, "CP-D80DW" },
@@ -14440,6 +14487,7 @@ static const value_string usb_products_vals[] = {
{ 0x07cec007, "DPB-4000" },
{ 0x07cec009, "DPB-6000" },
{ 0x07cec010, "CPB-7000" },
+ { 0x07cec011, "ASK-2500" },
{ 0x07cf1001, "QV-8000SX/5700/3000EX Digicam; Exilim EX-M20" },
{ 0x07cf1003, "Exilim EX-S500" },
{ 0x07cf1004, "Exilim EX-Z120" },
@@ -14549,8 +14597,11 @@ static const value_string usb_products_vals[] = {
{ 0x07fd0000, "FastLane MIDI Interface" },
{ 0x07fd0001, "MIDI Interface" },
{ 0x07fd0002, "MOTU Audio for 64 bit" },
- { 0x07fd0004, "MicroBook" },
+ { 0x07fd0004, "Microbook I/II/IIc" },
{ 0x07fd0008, "M Series" },
+ { 0x07fd0009, "M Series (firmware update mode)" },
+ { 0x07fd000b, "M Series" },
+ { 0x07fd000d, "M Series (firmware update mode)" },
{ 0x07ff00ff, "Portable Hard Drive" },
{ 0x07ffffff, "Mad Catz Gamepad" },
{ 0x08010001, "Mini Swipe Reader (Keyboard Emulation)" },
@@ -14589,6 +14640,7 @@ static const value_string usb_products_vals[] = {
{ 0x081edf00, "Handheld" },
{ 0x081fe401, "gamepad" },
{ 0x08222001, "IRXpress Infrared Device" },
+ { 0x0828a003, "WS408 Label Printer" },
{ 0x082d0100, "Visor" },
{ 0x082d0200, "Treo" },
{ 0x082d0300, "Treo 600" },
@@ -15111,6 +15163,12 @@ static const value_string usb_products_vals[] = {
{ 0x090804b2, "NC interface" },
{ 0x090804b3, "keyboard front panel Cockpit" },
{ 0x090804b4, "SCR_CCID" },
+ { 0x090804b5, "Camera" },
+ { 0x090804b6, "Cockpit Touchkeypad" },
+ { 0x090804b7, "Cockpit Touchkeypad Bootloader" },
+ { 0x090804b8, "MediSET USB4-W" },
+ { 0x090804b9, "MediSET USB4-R" },
+ { 0x090804ba, "MediSET USB4-G" },
{ 0x09082701, "ShenZhen SANZHAI Technology Co.,Ltd Spy Pen VGA" },
{ 0x0909001b, "ATR2100-USB" },
{ 0x0909001c, "AT2020USB+" },
@@ -15125,6 +15183,7 @@ static const value_string usb_products_vals[] = {
{ 0x090c037c, "300k Pixel Camera" },
{ 0x090c1000, "Flash Drive" },
{ 0x090c1132, "5-in-1 Card Reader" },
+ { 0x090c2000, "Disk" },
{ 0x090c337b, "Silicon Motion Camera" },
{ 0x090c3710, "Silicon Motion Camera" },
{ 0x090c3720, "Silicon Motion Camera" },
@@ -15239,6 +15298,7 @@ static const value_string usb_products_vals[] = {
{ 0x091e50a1, "Garmin Forerunner 265" },
{ 0x091e50db, "Garmin Forerunner 965" },
{ 0x091e5116, "Garmin Fenix 7s pro sapphire solar" },
+ { 0x09205550, "U60 FT Network Interface" },
{ 0x09207500, "Network Interface" },
{ 0x09211001, "GoCOM232 Serial" },
{ 0x09220007, "LabelWriter 330" },
@@ -15439,6 +15499,7 @@ static const value_string usb_products_vals[] = {
{ 0x0944010f, "nanoKONTROL studio controller" },
{ 0x09440117, "nanoKONTROL2 MIDI Controller" },
{ 0x0944012f, "SQ-1" },
+ { 0x09440203, "KRONOS" },
{ 0x09440f03, "K-Series K61P MIDI studio controller" },
{ 0x09480301, "USB Pro (24/48)" },
{ 0x09480302, "USB Pro (24/96 playback)" },
@@ -15504,6 +15565,8 @@ static const value_string usb_products_vals[] = {
{ 0x09557140, "T124 [Tegra K1/Logan 32-bit]" },
{ 0x09557210, "SHIELD Controller" },
{ 0x09557321, "Switch [Tegra Erista] recovery mode" },
+ { 0x09557323, "T234 [Orin NX 16GB] recovery mode" },
+ { 0x09557423, "T234 [Orin NX 8GB] recovery mode" },
{ 0x09557721, "nVidia Jetson TX1" },
{ 0x09557820, "T20 [Tegra 2] recovery mode" },
{ 0x09557c18, "T186 [TX2 Tegra Parker] recovery mode" },
@@ -15516,13 +15579,18 @@ static const value_string usb_products_vals[] = {
{ 0x0955cf07, "nVidia Shield Tablet (MTP)" },
{ 0x0955cf08, "SHIELD Tablet" },
{ 0x0955cf09, "SHIELD Tablet" },
+ { 0x09570007, "82357A GPIB Interface Firmware loader" },
+ { 0x09570107, "82357A GPIB Interface" },
{ 0x09570200, "E-Video DC-350 Camera" },
{ 0x09570202, "E-Video DC-350 Camera" },
{ 0x09570407, "33220A Waveform Generator" },
- { 0x09570518, "82357B GPIB Interface" },
+ { 0x09570518, "82357B GPIB Interface Firmware loader" },
+ { 0x09570607, "34410A Multimeter" },
+ { 0x09570718, "82357B GPIB Interface" },
{ 0x09570a07, "34411A Multimeter" },
{ 0x09571507, "33210A Waveform Generator" },
{ 0x09571745, "Test and Measurement Device (IVI)" },
+ { 0x09571907, "53230A Frequency Counter" },
{ 0x09571f01, "N5181A MXG Analog Signal Generator" },
{ 0x09572918, "U2702A oscilloscope" },
{ 0x0957fb18, "LC Device" },
@@ -15571,6 +15639,7 @@ static const value_string usb_products_vals[] = {
{ 0x099a6330, "SANWA Supply Inc. Slim Keyboard" },
{ 0x099a713a, "WK-713 Multimedia Keyboard" },
{ 0x099a7160, "Hyper Slim Keyboard" },
+ { 0x099a7202, "Enermax Aurora Micro Wireless Receiver" },
{ 0x09a68001, "Mass Storage Device" },
{ 0x09aa1000, "Prism GT 802.11b/g Adapter" },
{ 0x09aa3642, "Prism 2.x 802.11b Adapter" },
@@ -15628,12 +15697,15 @@ static const value_string usb_products_vals[] = {
{ 0x09d70100, "GPS/GNSS/SPAN sensor" },
{ 0x09d80320, "TWN3 Multi125" },
{ 0x09d80406, "TWN4 MIFARE NFC" },
+ { 0x09d80410, "TWN4 HID" },
+ { 0x09d80420, "TWN4 CDC" },
{ 0x09da0006, "Optical Mouse WOP-35 / Trust 450L Optical Mouse" },
{ 0x09da000a, "Optical Mouse Opto 510D / OP-620D" },
{ 0x09da000e, "X-F710F Optical Mouse 3xFire Gaming Mouse" },
{ 0x09da0018, "Trust Human Interface Device" },
{ 0x09da001a, "Wireless Mouse & RXM-15 Receiver" },
{ 0x09da002a, "Wireless Optical Mouse NB-30" },
+ { 0x09da0103, "Oscar X-710BK Gaming Mouse" },
{ 0x09da022b, "Wireless Mouse (Battery Free)" },
{ 0x09da024f, "RF Receiver and G6-20D Wireless Optical Mouse" },
{ 0x09da0260, "KV-300H Isolation Keyboard" },
@@ -15641,12 +15713,16 @@ static const value_string usb_products_vals[] = {
{ 0x09da09da, "Bloody V8 Mouse" },
{ 0x09da1068, "Bloody A90 Mouse" },
{ 0x09da112c, "Bloody V5 Mouse" },
+ { 0x09da2268, "Keyboard (FK11)" },
+ { 0x09da2690, "PK-635G" },
{ 0x09da3a60, "Bloody V8M Core 2 Mouse" },
{ 0x09da8090, "X-718BK Oscar Optical Gaming Mouse" },
{ 0x09da9033, "X-718BK Optical Mouse" },
{ 0x09da9066, "F3 V-Track Gaming Mouse" },
- { 0x09da9090, "XL-730K / XL-750BK / XL-755BK Mice" },
+ { 0x09da9090, "XL-730K / XL-747H / XL-750BK / XL-755BK Mice" },
{ 0x09daf613, "Bloody V7M Mouse" },
+ { 0x09daf6cc, "B314 Light Strike Gaming Keyboard" },
+ { 0x09dafa44, "B930 Light Strike RGB Mechanical Gaming Keyboard" },
{ 0x09db0075, "MiniLab 1008" },
{ 0x09db0076, "PMD-1024" },
{ 0x09db007a, "PMD-1208LS" },
@@ -15654,11 +15730,13 @@ static const value_string usb_products_vals[] = {
{ 0x09db0082, "USB-1208FS" },
{ 0x09db0088, "USB-1616FS internal hub" },
{ 0x09e15121, "MicroLink dLAN" },
+ { 0x09e80029, "APC40 mkII" },
{ 0x09e80045, "MPK Mini Mk II MIDI Controller" },
{ 0x09e80062, "MPD16 MIDI Pad Controller Unit" },
{ 0x09e8006d, "EWI electronic wind instrument" },
{ 0x09e80071, "MPK25 MIDI Keyboard" },
{ 0x09e80076, "LPK25 MIDI Keyboard" },
+ { 0x09e8007c, "MPK Mini MIDI Controller" },
{ 0x09eb4331, "iRhythm Tuner Remote" },
{ 0x09ef0101, "MD-Port DG2 MiniDisc Interface" },
{ 0x09f30018, "GF-46 Multi-Mode Display Module" },
@@ -15702,6 +15780,9 @@ static const value_string usb_products_vals[] = {
{ 0x0a121010, "Bluetooth Device" },
{ 0x0a121011, "Bluetooth Device" },
{ 0x0a121012, "Bluetooth Device" },
+ { 0x0a121243, "CSRA64210 [TaoTronics Headset BH-22 in charging mode]" },
+ { 0x0a124007, "Mpow HC5 Headset in charging mode - HID / Mass Storage" },
+ { 0x0a124010, "Mpow HC5 Headset in charging mode - USB Hub" },
{ 0x0a12ffff, "USB Bluetooth Device in DFU State" },
{ 0x0a161111, "ThumbDrive" },
{ 0x0a168888, "IBM USB Memory Key" },
@@ -15835,6 +15916,7 @@ static const value_string usb_products_vals[] = {
{ 0x0a5c217f, "BCM2045B (BDC-2.1)" },
{ 0x0a5c2198, "Bluetooth 3.0 Device" },
{ 0x0a5c219b, "Bluetooth 2.1 Device" },
+ { 0x0a5c219c, "BCM2070 Bluetooth" },
{ 0x0a5c21b1, "HP Bluetooth Module" },
{ 0x0a5c21b4, "BCM2070 Bluetooth 2.1 + EDR" },
{ 0x0a5c21b9, "BCM2070 Bluetooth 2.1 + EDR" },
@@ -15858,6 +15940,7 @@ static const value_string usb_products_vals[] = {
{ 0x0a5c5802, "BCM5880 Secure Applications Processor with fingerprint touch sensor" },
{ 0x0a5c5803, "BCM5880 Secure Applications Processor with secure keyboard" },
{ 0x0a5c5804, "BCM5880 Secure Applications Processor with fingerprint swipe sensor" },
+ { 0x0a5c5832, "BCM5880 Secure Applications Processor Smartcard reader" },
{ 0x0a5c6300, "Pirelli Remote NDIS Device" },
{ 0x0a5c6410, "BCM20703A1 Bluetooth 4.1 + LE" },
{ 0x0a5cbd11, "BCM4320 802.11bg Wireless Adapter" },
@@ -23311,6 +23394,8 @@ static const value_string usb_products_vals[] = {
{ 0x20870b03, "Multi Touch Panel" },
{ 0x20a00006, "flirc" },
{ 0x20a04107, "GPF Crypto Stick V1.2" },
+ { 0x20a04108, "Nitrokey Pro" },
+ { 0x20a04109, "Nitrokey Storage" },
{ 0x20a04123, "IKALOGIC SCANALOGIC 2" },
{ 0x20a0414a, "MDE SPI Interface" },
{ 0x20a0415a, "OpenPilot" },
@@ -23319,7 +23404,16 @@ static const value_string usb_products_vals[] = {
{ 0x20a041e5, "BlinkStick" },
{ 0x20a04211, "Nitrokey Start" },
{ 0x20a04223, "ATSAMD21 [castAR]" },
+ { 0x20a04230, "Nitrokey HSM" },
+ { 0x20a04287, "Nitrokey FIDO U2F" },
{ 0x20a0428d, "Electrosense wideband converter" },
+ { 0x20a042b1, "Nitrokey FIDO2" },
+ { 0x20a042b2, "Nitrokey 3A Mini/3A NFC/3C NFC" },
+ { 0x20a042b4, "Nitrokey Pro Bootloader" },
+ { 0x20a042da, "MuteMe" },
+ { 0x20a042dd, "Nitrokey 3A NFC Bootloader/3C NFC Bootloader" },
+ { 0x20a042e8, "Nitrokey 3A Mini Bootloader" },
+ { 0x20a042ec, "RP2040 [PicoWifi]" },
{ 0x20b110ad, "XUSB Loader" },
{ 0x20b1f7d1, "XTAG2 - JTAG Adapter" },
{ 0x20b30a18, "10.1 Touch screen overlay" },
@@ -23950,7 +24044,7 @@ static const value_string usb_products_vals[] = {
{ 0x25784168, "2.4GHZ Wireless Arc Folding Mouse" },
{ 0x25811807, "Generic HID Smartcard" },
{ 0x25811808, "WinUSB Smartcard" },
- { 0x2581f1d0, "FIDO U2F Security Key" },
+ { 0x2581f1d0, "Nitrokey U2F" },
{ 0x25a72410, "Laser mouse" },
{ 0x25a7fa23, "2.4G Receiver" },
{ 0x25a7fa61, "Elecom Co., Ltd MR-K013 Multicard Reader" },
@@ -24665,6 +24759,7 @@ static const value_string usb_products_vals[] = {
{ 0x33840000, "Thelio Io (thelio-io)" },
{ 0x33840001, "Launch Configurable Keyboard (launch_1)" },
{ 0x339b107d, "Honor X8/X9 5G" },
+ { 0x33a20136, "Olympus OM-1MarkII" },
{ 0x348f2322, "Wireless Presenter" },
{ 0x3504f110, "Security Key" },
{ 0x35380001, "Travel Flash" },