From beb119f911a698d44f4baa06d888bb1e775983bc Mon Sep 17 00:00:00 2001 From: Evan Huus Date: Sun, 11 May 2014 20:33:58 -0400 Subject: [PATCH] Don't use -1 as length in frame dissector. Additional belated followup to gfe195c0c9 per conversation on -dev about the use of -1 and when we should throw exceptions. See also g867a1827e7. Should (in theory) permit reverting gfe195c0c9. Bug:9999 Bug:10030 Change-Id: I56e5f4e5dc12fe82268243d0b113cfc9ff5fdd17 Reviewed-on: https://code.wireshark.org/review/1603 Reviewed-by: Anders Broman --- epan/dissectors/packet-frame.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c index 7a760ac550..ead86770fc 100644 --- a/epan/dissectors/packet-frame.c +++ b/epan/dissectors/packet-frame.c @@ -237,9 +237,9 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) } if(pinfo->pkt_comment){ - item = proto_tree_add_item(tree, proto_pkt_comment, tvb, 0, -1, ENC_NA); + item = proto_tree_add_item(tree, proto_pkt_comment, tvb, 0, 0, ENC_NA); comments_tree = proto_item_add_subtree(item, ett_comments); - comment_item = proto_tree_add_string_format(comments_tree, hf_comments_text, tvb, 0, -1, + comment_item = proto_tree_add_string_format(comments_tree, hf_comments_text, tvb, 0, 0, pinfo->pkt_comment, "%s", pinfo->pkt_comment); expert_add_info_format(pinfo, comment_item, &ei_comments_text, @@ -267,7 +267,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) cap_plurality = plurality(cap_len, "", "s"); frame_plurality = plurality(frame_len, "", "s"); - ti = proto_tree_add_protocol_format(tree, proto_frame, tvb, 0, -1, + ti = proto_tree_add_protocol_format(tree, proto_frame, tvb, 0, tvb_captured_length(tvb), "Frame %u: %u byte%s on wire", pinfo->fd->num, frame_len, frame_plurality); if (generate_bits_field) @@ -465,7 +465,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) if (pinfo->fd->flags.ignored) { /* Ignored package, stop handling here */ col_set_str(pinfo->cinfo, COL_INFO, ""); - proto_tree_add_text (tree, tvb, 0, -1, "This frame is marked as ignored"); + proto_tree_add_text (tree, tvb, 0, 0, "This frame is marked as ignored"); return; }