aboutsummaryrefslogtreecommitdiffstats
path: root/tshark.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2020-04-08 23:34:46 +0200
committerPeter Wu <peter@lekensteyn.nl>2020-04-08 21:58:21 +0000
commita0600e02a9a5fa02531ca3c2d5a2d82b325aab1c (patch)
tree372f61ad837dccce1d757ca52faba08d29e4ae0e /tshark.c
parentf71a5e0f02a4cedf576eabd605151f84c0349ca4 (diff)
tshark: fix use-after-free while closing a live capture file
wtap_cleanup() clears options which are still in use by the time cf_close calls wtap_close. Be sure to close the capture file first. Bug: 16487 Change-Id: Id9ef1c0321865e9574b69439870a842efb2b209b Fixes: v3.3.0rc0-853-g3662a69036 ("Maintain cf->state, because file cleanup depends on it.") Reviewed-on: https://code.wireshark.org/review/36755 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Guy Harris <gharris@sonic.net>
Diffstat (limited to 'tshark.c')
-rw-r--r--tshark.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tshark.c b/tshark.c
index 0098596a0c..f0d73c579e 100644
--- a/tshark.c
+++ b/tshark.c
@@ -2271,6 +2271,7 @@ main(int argc, char *argv[])
output_fields = NULL;
clean_exit:
+ cf_close(&cfile);
g_free(cf_name);
destroy_print_stream(print_stream);
g_free(output_file_name);
@@ -2281,7 +2282,6 @@ clean_exit:
free_filter_lists();
wtap_cleanup();
free_progdirs();
- cf_close(&cfile);
dfilter_free(dfcode);
return exit_status;
}