aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Grover <agrover@cloudflare.com>2022-01-11 09:49:54 -0800
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2022-01-12 09:39:44 +0000
commit93f960045f44d6c2f462dca82affe71c96a913b3 (patch)
tree515478e96fc2219328eb04d9011094f0830a86fe
parentaadaa2c5b0206603533763d6aeda64d65f49a748 (diff)
downloadwireshark-cherry-pick-c6e60da6-2.tar.gz
wireshark-cherry-pick-c6e60da6-2.tar.bz2
wireshark-cherry-pick-c6e60da6-2.zip
proxy protocol: Fix parsing of TLV valuescherry-pick-c6e60da6-2
Do not attempt to look for TLVs in the entire rest of the packet, only look in the proxy protocol header bytes. (cherry picked from commit c6e60da604fa9282e14c92acc28cb627d8ff4279)
-rw-r--r--epan/dissectors/packet-proxy.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/epan/dissectors/packet-proxy.c b/epan/dissectors/packet-proxy.c
index 7f92801947..3437e393e1 100644
--- a/epan/dissectors/packet-proxy.c
+++ b/epan/dissectors/packet-proxy.c
@@ -133,9 +133,9 @@ static const value_string proxy2_tlv_vals[] = {
};
static int
-dissect_proxy_v2_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *proxy_tree, int offset)
+dissect_proxy_v2_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *proxy_tree, int offset, int header_len)
{
- while ( tvb_reported_length_remaining(tvb, offset) > 0) {
+ while (offset < header_len) {
guint32 type, length;
proto_item *ti_tlv;
proto_tree *tlv_tree;
@@ -157,7 +157,7 @@ dissect_proxy_v2_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *proxy_tree,
offset += 1;
proto_tree_add_item(tlv_tree, hf_proxy2_tlv_ssl_verify, tvb, offset, 4, ENC_NA);
offset += 4;
- offset = dissect_proxy_v2_tlv(tvb, pinfo, tlv_tree, offset);
+ offset = dissect_proxy_v2_tlv(tvb, pinfo, tlv_tree, offset, header_len);
break;
case PP2_SUBTYPE_SSL_VERSION: /* SSL Version */
proto_tree_add_item(tlv_tree, hf_proxy2_tlv_ssl_version, tvb, offset, length, ENC_ASCII|ENC_NA);
@@ -483,7 +483,7 @@ dissect_proxy_v2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (offset < header_len) {
/* TLV */
- offset = dissect_proxy_v2_tlv(tvb, pinfo, proxy_tree, offset);
+ offset = dissect_proxy_v2_tlv(tvb, pinfo, proxy_tree, offset, header_len);
}
return offset;