aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2017-10-05 21:39:10 +0200
committerAnders Broman <a.broman58@gmail.com>2017-10-09 04:35:28 +0000
commitc6a0e2a7916a689dfb642b004d07f6fc76fd04f3 (patch)
tree1949f7d52d722a82b045f14dfc0c5c1f8dd22736 /epan
parent1df866d99e99346bf61d0f7c49600000048fa393 (diff)
packet.c: fix a control flow issue reported by Coverity (CID 1418671)
Let's perform the check before potentially breaking the loop. While we are at it, let's update the test to remove the last layer so as to match the one used to add it. Change-Id: I5807219de75c4e2c23b9435d6271ad60aec45783 Reviewed-on: https://code.wireshark.org/review/23844 Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan')
-rw-r--r--epan/packet.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/epan/packet.c b/epan/packet.c
index 00c6609f0f..37579fd294 100644
--- a/epan/packet.c
+++ b/epan/packet.c
@@ -767,7 +767,7 @@ call_dissector_work(dissector_handle_t handle, tvbuff_t *tvb, packet_info *pinfo
*/
len = call_dissector_through_handle(handle, tvb, pinfo, tree, data);
}
- if (add_proto_name &&
+ if (handle->protocol != NULL && !proto_is_pino(handle->protocol) && add_proto_name &&
(len == 0 || (tree && saved_tree_count == tree->tree_data->count))) {
/*
* We've added a layer and either the dissector didn't
@@ -2674,11 +2674,6 @@ dissector_try_heuristic(heur_dissector_list_t sub_dissectors, tvbuff_t *tvb,
pinfo->heur_list_name = hdtbl_entry->list_name;
len = (hdtbl_entry->dissector)(tvb, pinfo, tree, data);
- if (len) {
- *heur_dtbl_entry = hdtbl_entry;
- status = TRUE;
- break;
- }
if (hdtbl_entry->protocol != NULL &&
(len == 0 || (tree && saved_tree_count == tree->tree_data->count))) {
/*
@@ -2691,6 +2686,11 @@ dissector_try_heuristic(heur_dissector_list_t sub_dissectors, tvbuff_t *tvb,
wmem_list_remove_frame(pinfo->layers, wmem_list_tail(pinfo->layers));
}
}
+ if (len) {
+ *heur_dtbl_entry = hdtbl_entry;
+ status = TRUE;
+ break;
+ }
}
pinfo->current_proto = saved_curr_proto;