aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-canopen.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2015-04-02 07:54:24 -0400
committerMichael Mann <mmann78@netscape.net>2015-04-04 13:01:27 +0000
commit9d10be54c7b1540642848c7ea1d273a7acbf229a (patch)
tree7d3c1eba4f6c2962258262e788e5144fc031dd9a /epan/dissectors/packet-canopen.c
parent267e169252f265eb1e6656c7c85563038d08d406 (diff)
Some CANopen frame types can have zero size, so use tvb_reported_length instead of -1.
Bug: 11083 Change-Id: Ib17649fbbc4f79705e3ad18903b5c8847cb09054 Reviewed-on: https://code.wireshark.org/review/7881 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Evan Huus <eapache@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-canopen.c')
-rw-r--r--epan/dissectors/packet-canopen.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/epan/dissectors/packet-canopen.c b/epan/dissectors/packet-canopen.c
index c4407ee785..201768f39c 100644
--- a/epan/dissectors/packet-canopen.c
+++ b/epan/dissectors/packet-canopen.c
@@ -980,8 +980,7 @@ dissect_canopen(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
}
}
- ti = proto_tree_add_item(tree, proto_canopen, tvb, 0,
- (msg_type_id == MT_SYNC) || (msg_type_id == MT_NMT_ERR_CTRL) ? 0 : -1, ENC_NA);
+ ti = proto_tree_add_item(tree, proto_canopen, tvb, 0, tvb_reported_length(tvb), ENC_NA);
canopen_tree = proto_item_add_subtree(ti, ett_canopen);
/* add COB-ID with function code and node id */
@@ -999,7 +998,7 @@ dissect_canopen(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
/* add CANopen frame type */
canopen_type_tree = proto_tree_add_subtree_format(canopen_tree, tvb, 0,
- (msg_type_id == MT_SYNC) || (msg_type_id == MT_NMT_ERR_CTRL) ? 0 : -1,
+ tvb_reported_length(tvb),
ett_canopen_type, NULL, "Type: %s", function_code_str);
switch(msg_type_id)
{