diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2014-06-18 01:30:35 +0200 |
---|---|---|
committer | Pascal Quantin <pascal.quantin@gmail.com> | 2014-06-18 05:53:10 +0000 |
commit | 04c90090d968c5d8528a09821d8b60a9eb487143 (patch) | |
tree | 5018e0207e95766b3dd9a0e90100c0be25d66ebe | |
parent | 57b27ec2508b6f97e7ba9bc44508bcd4426ffa53 (diff) |
TCP: do desegmentation sanity checks for all sub dissectors types
Change-Id: I02fe9827d8c1618f7dc6696e7d8667681a48d4a9
Reviewed-on: https://code.wireshark.org/review/2355
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
-rw-r--r-- | epan/dissectors/packet-tcp.c | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c index dfc05a68fd..7452056462 100644 --- a/epan/dissectors/packet-tcp.c +++ b/epan/dissectors/packet-tcp.c @@ -3872,6 +3872,9 @@ decode_tcp_ports(tvbuff_t *tvb, int offset, packet_info *pinfo, } next_tvb = tvb_new_subset_remaining(tvb, offset); + save_desegment_offset = pinfo->desegment_offset; + save_desegment_len = pinfo->desegment_len; + /* determine if this packet is part of a conversation and call dissector */ /* for the conversation if available */ @@ -3883,21 +3886,10 @@ decode_tcp_ports(tvbuff_t *tvb, int offset, packet_info *pinfo, if (try_heuristic_first) { /* do lookup with the heuristic subdissector table */ - save_desegment_offset = pinfo->desegment_offset; - save_desegment_len = pinfo->desegment_len; if (dissector_try_heuristic(heur_subdissector_list, next_tvb, pinfo, tree, &hdtbl_entry, tcpinfo)) { pinfo->want_pdu_tracking -= !!(pinfo->want_pdu_tracking); return TRUE; } - /* - * They rejected the packet; make sure they didn't also request - * desegmentation (we could just override the request, but - * rejecting a packet *and* requesting desegmentation is a sign - * of the dissector's code needing clearer thought, so we fail - * so that the problem is made more obvious). - */ - DISSECTOR_ASSERT(save_desegment_offset == pinfo->desegment_offset && - save_desegment_len == pinfo->desegment_len); } /* Do lookups with the subdissector table. @@ -3944,23 +3936,22 @@ decode_tcp_ports(tvbuff_t *tvb, int offset, packet_info *pinfo, if (!try_heuristic_first) { /* do lookup with the heuristic subdissector table */ - save_desegment_offset = pinfo->desegment_offset; - save_desegment_len = pinfo->desegment_len; if (dissector_try_heuristic(heur_subdissector_list, next_tvb, pinfo, tree, &hdtbl_entry, tcpinfo)) { pinfo->want_pdu_tracking -= !!(pinfo->want_pdu_tracking); return TRUE; } - /* - * They rejected the packet; make sure they didn't also request - * desegmentation (we could just override the request, but - * rejecting a packet *and* requesting desegmentation is a sign - * of the dissector's code needing clearer thought, so we fail - * so that the problem is made more obvious). - */ - DISSECTOR_ASSERT(save_desegment_offset == pinfo->desegment_offset && - save_desegment_len == pinfo->desegment_len); } + /* + * heuristic / conversation / port registered dissectors rejected the packet; + * make sure they didn't also request desegmentation (we could just override + * the request, but rejecting a packet *and* requesting desegmentation is a sign + * of the dissector's code needing clearer thought, so we fail so that the + * problem is made more obvious). + */ + DISSECTOR_ASSERT(save_desegment_offset == pinfo->desegment_offset && + save_desegment_len == pinfo->desegment_len); + /* Oh, well, we don't know this; dissect it as data. */ call_dissector(data_handle,next_tvb, pinfo, tree); @@ -4252,7 +4243,7 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tcp_calculate_ts) { tcppd = (struct tcp_per_packet_data_t *)p_get_proto_data(wmem_file_scope(), pinfo, proto_tcp, 0); - /*https://raw.githubusercontent.com/FreeRADIUS/freeradius-server/master/.travis.yml + /* * Calculate the timestamps relative to this conversation (but only on the * first run when frames are accessed sequentially) */ |