path: root/file.c
diff options
authorJakub Zawadzki <darkjames-ws@darkjames.pl>2018-01-24 03:34:48 +0100
committerAnders Broman <a.broman58@gmail.com>2018-01-30 05:48:52 +0000
commitc9d98323f62d3fd1a1a3ee598c991a03a1fdb3af (patch)
tree15efc874205d92c91581c12358cae1dbe47a131f /file.c
parenta584eab239d55e441433ead40c993e08a24c59fe (diff)
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>
Diffstat (limited to 'file.c')
1 files changed, 1 insertions, 1 deletions
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,