diff options
author | Alexis La Goutte <alexis.lagoutte@gmail.com> | 2016-10-04 15:16:02 +0200 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2016-10-04 21:55:26 +0000 |
commit | 23f11b755202d6ba9b7a8b80df7264992e3a41f0 (patch) | |
tree | 7df14845f59dc86e192bc1e20e983ac37aff97d2 /epan | |
parent | dda1ee05b3b5e439a3dd1ed6944f5e797b5ed995 (diff) |
Openflow (v4/v5): Add check if all length is decoded
Change-Id: I7846dd04c45d0398ded8345b6a2794d6f851cb64
Ping-Bug: 12979
Reviewed-on: https://code.wireshark.org/review/18065
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-openflow_v4.c | 8 | ||||
-rw-r--r-- | epan/dissectors/packet-openflow_v5.c | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/epan/dissectors/packet-openflow_v4.c b/epan/dissectors/packet-openflow_v4.c index 1d84e6d9f3..c621115d4f 100644 --- a/epan/dissectors/packet-openflow_v4.c +++ b/epan/dissectors/packet-openflow_v4.c @@ -992,6 +992,7 @@ dissect_openflow_oxm_v4(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, { proto_tree *oxm_tree; guint16 oxm_class; + guint16 oxm_end; guint8 oxm_field_hm; guint8 oxm_hm; guint8 oxm_field; @@ -1001,6 +1002,7 @@ dissect_openflow_oxm_v4(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, oxm_class = tvb_get_ntohs(tvb, offset); oxm_field_hm = tvb_get_guint8(tvb, offset + 2); oxm_length = tvb_get_guint8(tvb, offset + 3); + oxm_end = offset + 4 + oxm_length; oxm_field = (oxm_field_hm & OXM_FIELD_MASK) >> OXM_FIELD_OFFSET; oxm_hm = oxm_field_hm & OXM_HM_MASK; @@ -1106,6 +1108,12 @@ dissect_openflow_oxm_v4(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, break; } + if(oxm_end > offset){ + proto_tree_add_expert_format(oxm_tree, pinfo, &ei_openflow_v4_oxm_undecoded, + tvb, offset, oxm_end-offset, "Undecoded Data"); + offset = oxm_end; + } + } else { if (oxm_class == OFPXMC_EXPERIMENTER) { oxm_length -= 4; /* oxm_length includes experimenter field */ diff --git a/epan/dissectors/packet-openflow_v5.c b/epan/dissectors/packet-openflow_v5.c index cc9d9d4d4e..dc9d78d801 100644 --- a/epan/dissectors/packet-openflow_v5.c +++ b/epan/dissectors/packet-openflow_v5.c @@ -1146,6 +1146,7 @@ dissect_openflow_oxm_v5(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, { proto_tree *oxm_tree; guint16 oxm_class; + guint16 oxm_end; guint8 oxm_field_hm; guint8 oxm_hm; guint8 oxm_field; @@ -1155,6 +1156,7 @@ dissect_openflow_oxm_v5(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, oxm_class = tvb_get_ntohs(tvb, offset); oxm_field_hm = tvb_get_guint8(tvb, offset + 2); oxm_length = tvb_get_guint8(tvb, offset + 3); + oxm_end = offset + 4 + oxm_length; oxm_field = (oxm_field_hm & OXM_FIELD_MASK) >> OXM_FIELD_OFFSET; oxm_hm = oxm_field_hm & OXM_HM_MASK; @@ -1260,6 +1262,12 @@ dissect_openflow_oxm_v5(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, break; } + if(oxm_end > offset){ + proto_tree_add_expert_format(oxm_tree, pinfo, &ei_openflow_v5_oxm_undecoded, + tvb, offset, oxm_end-offset, "Undecoded Data"); + offset = oxm_end; + } + } else { proto_tree_add_expert_format(oxm_tree, pinfo, &ei_openflow_v5_oxm_undecoded, tvb, offset, oxm_length, "Unknown OXM body."); |