tcp: Mark unreassembled PDUs as fragmented in tcp_dissect_pdus

PDUs on TCP streams can fail to be reassembled for a variety of reasons,
most of which can be determined by the TCP dissector before calling
a subdissector.  However, individual subdissectors can have their own
preference indicating not to desegment, and this cannot be handled until
the subdissector calls tcp_dissect_pdus(). Fix #18027.
This commit is contained in:
John Thacker 2022-04-05 23:49:04 -04:00
parent b4a0b30f88
commit f5567200fa
1 changed files with 11 additions and 0 deletions

View File

@ -4361,6 +4361,17 @@ tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
if (length > plen)
length = plen;
next_tvb = tvb_new_subset_length_caplen(tvb, offset, length, plen);
if (!(proto_desegment && pinfo->can_desegment)) {
if (plen > length) {
/* If we can't do reassembly but the PDU is split across
* segment boundaries, mark the tvbuff as a fragment so
* we throw FragmentBoundsError instead of malformed
* errors.
*/
tvb_set_fragment(next_tvb);
}
}
/*
* Dissect the PDU.