aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2018-01-17 14:54:36 +0100
committerAlexis La Goutte <alexis.lagoutte@gmail.com>2018-01-18 06:06:24 +0000
commitc3e6597f2034c183f74258c1dd03146c98d4688b (patch)
tree027e3f7355aab8b6984f57fbc50a06e9b5620bde
parente6d47cb7b3319f134dcc2a38885d1917218f6e7a (diff)
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 <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
-rw-r--r--file.c4
1 files changed, 4 insertions, 0 deletions
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. */