aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchinarulezzz <alexandr.savca89@gmail.com>2018-04-13 17:21:25 +0300
committerAnders Broman <a.broman58@gmail.com>2018-04-14 08:46:31 +0000
commit89076e6a5d7f44d9cd2ce0f38ba359417091df26 (patch)
tree9152335027e8e6ea8fa2b2fd0ecba87b561e285c
parent2d0f894140eae6098f1fdf54aff1413bf5d84851 (diff)
packet-pcep.c: opposite inner 'if' condition leads to a dead code block
Change-Id: I13e32d7f333c3e50085c0008d7677f4c6d0611d4 Reviewed-on: https://code.wireshark.org/review/26928 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--epan/dissectors/packet-pcep.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/epan/dissectors/packet-pcep.c b/epan/dissectors/packet-pcep.c
index 7ab0815d9e..722774fd89 100644
--- a/epan/dissectors/packet-pcep.c
+++ b/epan/dissectors/packet-pcep.c
@@ -2837,12 +2837,13 @@ dissect_pcep_xro_obj(proto_tree *pcep_object_tree, packet_info *pinfo, tvbuff_t
offset2 += XRO_OBJ_MIN_LEN;
body_obj_len -= XRO_OBJ_MIN_LEN;
+ if (body_obj_len < 2) {
+ expert_add_info_format(pinfo, pcep_object_tree, &ei_pcep_subobject_bad_length,
+ "Bad XRO object: subobject goes past end of object");
+ return;
+ }
+
while (body_obj_len >= 2) {
- if (body_obj_len < 2) {
- expert_add_info_format(pinfo, pcep_object_tree, &ei_pcep_subobject_bad_length,
- "Bad XRO object: subobject goes past end of object");
- break;
- }
x_type = tvb_get_guint8(tvb, offset2);
length = tvb_get_guint8(tvb, offset2+1);
@@ -2855,7 +2856,7 @@ dissect_pcep_xro_obj(proto_tree *pcep_object_tree, packet_info *pinfo, tvbuff_t
type_xro = (x_type & Mask_Type);
- if (body_obj_len <length) {
+ if (body_obj_len < length) {
proto_tree_add_expert_format(pcep_object_tree, pinfo, &ei_pcep_subobject_bad_length,
tvb, offset2, length,
"Bad XRO object: object length %u > remaining length %u",