Use tvb_new_subset_length() rather than tvb_new_subset().
authorGuy Harris <guy@alum.mit.edu>
Tue, 16 Sep 2014 21:30:16 +0000 (14:30 -0700)
committerGuy Harris <guy@alum.mit.edu>
Tue, 16 Sep 2014 21:30:47 +0000 (21:30 +0000)
We rarely, if ever, want to, or need to, explicitly set the captured
length of a packet; we want to set the *reported* length and let the
tvbuff code figure out how much of that data was actually captured.

Change-Id: I9b93d296197989f677d888b10954589dfc1edc59
Reviewed-on: https://code.wireshark.org/review/4138
Reviewed-by: Guy Harris <guy@alum.mit.edu>
epan/proto.c

index 06ffa93017f40a89a0f4c0aa4ce2579957acd1e0..88c3e33f091955f42d4287cac822c96b006f5634 100644 (file)
@@ -2403,7 +2403,7 @@ proto_tree_add_protocol_format(proto_tree *tree, int hfindex, tvbuff_t *tvb,
 
        pi = proto_tree_add_pi(tree, hfinfo, tvb, start, &length);
 
-       proto_tree_set_protocol_tvb(PNODE_FINFO(pi), (start == 0 ? tvb : tvb_new_subset(tvb, start, length, length)));
+       proto_tree_set_protocol_tvb(PNODE_FINFO(pi), (start == 0 ? tvb : tvb_new_subset_length(tvb, start, length)));
 
        TRY_TO_FAKE_THIS_REPR(pi);