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>
This commit is contained in:
Michael Mann 2015-04-02 07:54:24 -04:00
parent 267e169252
commit 9d10be54c7
1 changed files with 2 additions and 3 deletions

View File

@ -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)
{