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>
This commit is contained in:
Alexis La Goutte 2016-10-04 15:16:02 +02:00 committed by Michael Mann
parent dda1ee05b3
commit 23f11b7552
2 changed files with 16 additions and 0 deletions

View File

@ -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 */

View File

@ -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.");