aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorvahapemin <vahapemin44@gmail.com>2020-07-09 04:09:25 -0700
committerAnders Broman <a.broman58@gmail.com>2020-07-16 08:17:55 +0000
commit48237f77aaec85def2200cb16d249fdc38b6eb2a (patch)
treeb8dc341c44436be9258a1335074dec19313d5927 /plugins
parenta5533561db85d440c2c0aa18ab3a708b3bbe379c (diff)
Profinet: Wrong Block Length Dissection Fix
There were some cases which has zero remaining data and it was causing an error. Remaining Data length check added. Change-Id: Ib0132d892e871c0f7980ff297d18c276aee26ba6 Reviewed-on: https://code.wireshark.org/review/37815 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/epan/profinet/packet-pn-dcp.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/plugins/epan/profinet/packet-pn-dcp.c b/plugins/epan/profinet/packet-pn-dcp.c
index fd3b394acd..c3b7151241 100644
--- a/plugins/epan/profinet/packet-pn-dcp.c
+++ b/plugins/epan/profinet/packet-pn-dcp.c
@@ -1160,12 +1160,15 @@ dissect_PNDCP_Suboption_Manuf(tvbuff_t *tvb, int offset, packet_info *pinfo,
guint16 block_length;
offset = dissect_pn_uint8( tvb, offset, pinfo, tree, hf_pn_dcp_suboption_manuf, NULL);
- offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_length, &block_length);
pn_append_info(pinfo, dcp_item, ", Manufacturer Specific");
proto_item_append_text(block_item, "Manufacturer Specific");
- offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, block_length);
+ if (tvb_reported_length_remaining(tvb, offset)>0)
+ {
+ offset = dissect_pn_uint16(tvb, offset, pinfo, tree, hf_pn_dcp_block_length, &block_length);
+ offset = dissect_pn_undecoded(tvb, offset, pinfo, tree, block_length);
+ }
return offset;
}
@@ -1225,7 +1228,7 @@ dissect_PNDCP_Block(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_item_set_len(block_item, offset-ori_offset);
- if ((offset-ori_offset) & 1) {
+ if (((offset-ori_offset) & 1) && (tvb_reported_length_remaining(tvb, offset) > 0)) {
/* we have an odd number of bytes in this block, add a padding byte */
offset = dissect_pn_padding(tvb, offset, pinfo, tree, 1);
}