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 <a.broman58@gmail.com>
This commit is contained in:
Evan Huus 2014-05-11 20:33:58 -04:00 committed by Anders Broman
parent b2055d73a8
commit beb119f911
1 changed files with 4 additions and 4 deletions

View File

@ -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, "<Ignored>");
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;
}