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 <darkjames-ws@darkjames.pl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Jakub Zawadzki 2018-01-24 03:34:48 +01:00 committed by Anders Broman
parent a584eab239
commit c9d98323f6
1 changed files with 1 additions and 1 deletions

2
file.c
View File

@ -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,