aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-clnp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-04-20 02:53:57 +0000
committerGuy Harris <guy@alum.mit.edu>2013-04-20 02:53:57 +0000
commit0efcd0632b5635d420652497d70063a0688ce1b1 (patch)
treee3101bf7dcc6871ceba878e70f34de8539eebe6b /epan/dissectors/packet-clnp.c
parent5524d0f8011145803d7b469e72f51214e2719c0e (diff)
When we're dissecting the beginning of a fragmented packet that we
haven't reassembled, we're probably moving sequentially through the packet, which means that we'll run past the end of the fragment rather than past the end of what would have been the reassembled packet had we reassembled it. I.e., there's little reason to care whether we're past the end of the fragment but not past the end of the packet, or whether we're past the end of the packet; in either case, we're past the end of the fragment, and if somebody wants to know whether the packet is malformed by stopping short of certain fields, they should enable reassembly. So we get rid of the explicit fragment length in tvbuffs and, instead, have a "this is a fragment" flag; if that flag is set, we throw FragmentBoundsError rather than ReportedBoundsError if we run past the end of the reported data. (This also means we could flag the tvbuff even if we don't know how large the reassembled packet will be, e.g. when doing IP reassembly.) Replace tvb_new_subset_length_fragment() with tvb_new_subset_length() and a new "set the "this is a fragment flag"" routine. svn path=/trunk/; revision=48940
Diffstat (limited to 'epan/dissectors/packet-clnp.c')
-rw-r--r--epan/dissectors/packet-clnp.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/epan/dissectors/packet-clnp.c b/epan/dissectors/packet-clnp.c
index 99182eed27..517a65e894 100644
--- a/epan/dissectors/packet-clnp.c
+++ b/epan/dissectors/packet-clnp.c
@@ -536,10 +536,14 @@ dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
} else {
/* First segment, or not segmented. Dissect what we have here. */
- /* Get a tvbuff for the payload. */
- next_tvb = tvb_new_subset_length_fragment(tvb, offset,
- segment_length - cnf_hdr_len,
- total_length - cnf_hdr_len);
+ /* Get a tvbuff for the payload. Set its length to the segment
+ length, and flag it as a fragment, so going past the end
+ reports FragmentBoundsError, i.e. "there's data missing
+ because this isn't reassembled", not ReportedBoundsError,
+ i.e. "the dissector ran past the end of the packet, so the
+ packet must not have been constructed properly". */
+ next_tvb = tvb_new_subset_length(tvb, offset, segment_length - cnf_hdr_len);
+ tvb_set_fragment(next_tvb);
/*
* If this is the first segment, but not the only segment,