From c9d98323f62d3fd1a1a3ee598c991a03a1fdb3af Mon Sep 17 00:00:00 2001 From: Jakub Zawadzki Date: Wed, 24 Jan 2018 03:34:48 +0100 Subject: file.c: Fix read from array index out of bounds. callback_args.col_widths[] is allocated only for visible columns, use 'visible_col_count' index instead of 'i' one, which is incremented only for visible columns. Found by clang. Change-Id: I4e3c05fd372585295e3a0d7427497a46f32f93bb Reviewed-on: https://code.wireshark.org/review/25444 Petri-Dish: Jakub Zawadzki Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'file.c') diff --git a/file.c b/file.c index 570edd546d..be2441d737 100644 --- a/file.c +++ b/file.c @@ -2412,7 +2412,7 @@ cf_print_packets(capture_file *cf, print_args_t *print_args, /* Find the length of the string for this column. */ column_len = (int) strlen(cf->cinfo.columns[i].col_title); - if (callback_args.col_widths[i] > column_len) + if (callback_args.col_widths[visible_col_count] > column_len) column_len = callback_args.col_widths[visible_col_count]; /* Make sure there's room in the line buffer for the column; if not, -- cgit v1.2.3