aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorPascal Quantin <pascal@wireshark.org>2019-05-13 22:55:46 +0200
committerPascal Quantin <pascal@wireshark.org>2019-05-14 11:13:03 +0000
commitfed0e7c2d09be11bd0c65aa5f8f420d61d2f773b (patch)
treefe4f0d67850eaf7347370f733de6183254a635c1 /plugins
parent7e8a58e1e1d429ea2f3f51f1d910ee6e910471bc (diff)
PROFINET DCP: fix dissection of an empty DHCP option
Bug: 15774 Change-Id: Ief2588e5d6f43da708ef071a4490f5f881268820 Reviewed-on: https://code.wireshark.org/review/33186 Petri-Dish: Pascal Quantin <pascal@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Mehmet Oguz Sakaoglu <mehmet.oguz.mnz@gmail.com> Reviewed-by: Pascal Quantin <pascal@wireshark.org>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/epan/profinet/packet-pn-dcp.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/plugins/epan/profinet/packet-pn-dcp.c b/plugins/epan/profinet/packet-pn-dcp.c
index c4c18091b0..41746ac901 100644
--- a/plugins/epan/profinet/packet-pn-dcp.c
+++ b/plugins/epan/profinet/packet-pn-dcp.c
@@ -908,24 +908,25 @@ dissect_PNDCP_Suboption_DHCP(tvbuff_t *tvb, int offset, packet_info *pinfo,
}
offset += 1;//SuboptionDHCP
offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_dhcp_parameter_length, &dhcpparameterlength);
- offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_dhcp_parameter_data, &dhcpparameterdata);
-
- if (dhcpparameterlength == 1) {
- if (dhcpparameterdata == 1) {
- proto_item_append_text(block_item, ", Client-ID: MAC Address");
+ if (dhcpparameterlength > 0) {
+ offset = dissect_pn_uint8(tvb, offset, pinfo, tree, hf_pn_dcp_suboption_dhcp_parameter_data, &dhcpparameterdata);
+ if (dhcpparameterlength == 1) {
+ if (dhcpparameterdata == 1) {
+ proto_item_append_text(block_item, ", Client-ID: MAC Address");
+ }
+ else {
+ proto_item_append_text(block_item, ", Client-ID: Name of Station");
+ }
}
else {
- proto_item_append_text(block_item, ", Client-ID: Name of Station");
+ proto_item_append_text(block_item, ", Client-ID: Arbitrary");
+ arbitraryclientID = (char *)wmem_alloc(wmem_packet_scope(), dhcpparameterlength);
+ tvb_memcpy(tvb, (guint8 *)arbitraryclientID, offset, dhcpparameterlength - 1);
+ arbitraryclientID[dhcpparameterlength - 1] = '\0';
+ proto_tree_add_string(tree, hf_pn_dcp_suboption_dhcp_arbitrary_client_id, tvb, offset, dhcpparameterlength - 1, arbitraryclientID);
+ offset += dhcpparameterlength;
}
}
- else {
- proto_item_append_text(block_item, ", Client-ID: Arbitrary");
- arbitraryclientID = (char *)wmem_alloc(wmem_packet_scope(), dhcpparameterlength);
- tvb_memcpy(tvb, (guint8 *)arbitraryclientID, offset, 5);
- arbitraryclientID[dhcpparameterlength - 1] = '\0';
- proto_tree_add_string(tree, hf_pn_dcp_suboption_dhcp_arbitrary_client_id, tvb, offset, dhcpparameterlength - 1, arbitraryclientID);
- offset += dhcpparameterlength;
- }
break;
case PNDCP_SUBOPTION_DHCP_CONTROL_FOR_ADDRESS_RES:
pn_append_info(pinfo, dcp_item, ", Control DHCP for address resolution");