forked from osmocom/wireshark
packet: ensure pinfo->curr_layer_num does not depend on tree
The TLS dissector relies on a stable value for pinfo->curr_layer_num between passes to enable handshake reassembly and decryption. A mismatch could occur if the subdissector accepted the data (len is non-zero), but did not add any tree items (tree->tree_data->count remains unchanged). The original change added the check for tree->tree_data->count in order to remove protocol names that are not visible in the tree. This could for example occur when the HTTP dissector accepts the data but requests more data for reassembly. This desire to hide protocols is understandable, so simply reverting the change would not be ok. Checking pinfo->desegment_offset is also not stable. So that leaves the current approach. Change-Id: I247adafbaa6d23ab9397eadacabaed9e1bfde997 Ping-Bug: 15625 Fixes: v2.5.0rc0-1206-gcd90f732a1 ("Improve frame.protocols accuracy.") Reviewed-on: https://code.wireshark.org/review/32919 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Pascal Quantin <pascal@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
c802a83363
commit
5076e53ffb
|
@ -798,7 +798,15 @@ call_dissector_work(dissector_handle_t handle, tvbuff_t *tvb, packet_info *pinfo
|
|||
* tree. Remove it.
|
||||
*/
|
||||
while (wmem_list_count(pinfo->layers) > saved_layers_len) {
|
||||
pinfo->curr_layer_num--;
|
||||
if (len == 0) {
|
||||
/*
|
||||
* Only reduce the layer number if the dissector
|
||||
* rejected the data. Since tree can be NULL on
|
||||
* the first pass, we cannot check it or it will
|
||||
* break dissectors that rely on a stable value.
|
||||
*/
|
||||
pinfo->curr_layer_num--;
|
||||
}
|
||||
wmem_list_remove_frame(pinfo->layers, wmem_list_tail(pinfo->layers));
|
||||
}
|
||||
}
|
||||
|
@ -2756,7 +2764,15 @@ dissector_try_heuristic(heur_dissector_list_t sub_dissectors, tvbuff_t *tvb,
|
|||
* items to the tree so remove it from the list.
|
||||
*/
|
||||
while (wmem_list_count(pinfo->layers) > saved_layers_len) {
|
||||
pinfo->curr_layer_num--;
|
||||
if (len == 0) {
|
||||
/*
|
||||
* Only reduce the layer number if the dissector
|
||||
* rejected the data. Since tree can be NULL on
|
||||
* the first pass, we cannot check it or it will
|
||||
* break dissectors that rely on a stable value.
|
||||
*/
|
||||
pinfo->curr_layer_num--;
|
||||
}
|
||||
wmem_list_remove_frame(pinfo->layers, wmem_list_tail(pinfo->layers));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue