aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2017-02-14 10:05:01 +0100
committerMichael Mann <mmann78@netscape.net>2017-02-18 14:21:27 +0000
commitfcc9cf2e454be68348f19cb4416702a208da5fb3 (patch)
tree8645dca7483f3e2fce5281053a001ada083adb02
parent64d0133e8811102f153253e42385d992da072911 (diff)
proto: ensure that length is set for proto_tree_add_item_new_ret_length
A user reported that the TNS dissector would show "Malformed Packet" in the Info column in Qt. The actual packet details and Expert Info dialog however had no trace of the issue. It turns out that proto_tree_add_item_new_ret_length did not correctly set the length. Test case (based on pcap from SampleCaptures wiki): tshark -r TNS_Oracle1.pcap -w 19.pcap -Y frame.number==19 tshark -r 19.pcap -Y tcp Change-Id: I82cb1ccbc7c3b33d2bcdb22f89a1754c1a4575e7 Fixes: v2.1.0rc0-1394-gc67c6e8f30 ("Add routines to add an item and return the item's real length.") Reviewed-on: https://code.wireshark.org/review/20098 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jörg Mayer <jmayer@loplof.de> Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r--epan/proto.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/epan/proto.c b/epan/proto.c
index 2e6cea999b..b3a5c0bc32 100644
--- a/epan/proto.c
+++ b/epan/proto.c
@@ -2633,7 +2633,14 @@ proto_tree_add_item_new_ret_length(proto_tree *tree, header_field_info *hfinfo,
return NULL;
}
- TRY_TO_FAKE_THIS_ITEM(tree, hfinfo->id, hfinfo);
+ TRY_TO_FAKE_THIS_ITEM_OR_FREE(tree, hfinfo->id, hfinfo, {
+ /*
+ * Even if the tree item is not referenced (and thus faked),
+ * the caller must still be informed of the actual length.
+ */
+ *lenretval = get_full_length(hfinfo, tvb, start, length,
+ item_length, encoding);
+ });
new_fi = new_field_info(tree, hfinfo, tvb, start, item_length);