From c3e6597f2034c183f74258c1dd03146c98d4688b Mon Sep 17 00:00:00 2001 From: Dario Lombardo Date: Wed, 17 Jan 2018 14:54:36 +0100 Subject: file: stop printing packets if 0 columns are asked (found by clang). This prevents a 0 bytes memory allocation (line 2383/4) and its subsequent dereference (line 2399). Change-Id: Ie88293699a55b9b48afe23d7371798e709bc1eaa Reviewed-on: https://code.wireshark.org/review/25351 Petri-Dish: Dario Lombardo Tested-by: Petri Dish Buildbot Reviewed-by: Alexis La Goutte --- file.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'file.c') diff --git a/file.c b/file.c index 54172f6e89..79bfcde602 100644 --- a/file.c +++ b/file.c @@ -2372,6 +2372,10 @@ cf_print_packets(capture_file *cf, print_args_t *print_args, } } + /* if num_visible_col is 0, we are done */ + if (num_visible_col == 0) + return CF_PRINT_OK; + /* Find the widths for each of the columns - maximum of the width of the title and the width of the data - and construct a buffer with a line containing the column titles. */ -- cgit v1.2.3