From aeb112fde85197d4bf665d513d333ace0896c4f8 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 25 Sep 2016 11:21:57 -0700 Subject: Do GArray bounds checking. Make sure we aren't going past the end of the array of per-interface packet counts. Change-Id: I6e19a5d375ebcc2193c37dc42c8f49836a5fd2c7 Reviewed-on: https://code.wireshark.org/review/17924 Reviewed-by: Guy Harris --- capinfos.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'capinfos.c') diff --git a/capinfos.c b/capinfos.c index beef85ecc0..048f546df4 100644 --- a/capinfos.c +++ b/capinfos.c @@ -736,9 +736,12 @@ print_stats(const gchar *filename, capture_info *cf_info) printf ("Number of interfaces in file: %u\n", cf_info->num_interfaces); for (i = 0; i < cf_info->idb_info_strings->len; i++) { gchar *s = g_array_index(cf_info->idb_info_strings, gchar*, i); + guint32 packet_count = 0; + if (i < cf_info->interface_packet_counts->len) + packet_count = g_array_index(cf_info->interface_packet_counts, guint32, i); printf ("Interface #%u info:\n", i); printf ("%s", s); - printf (" Number of packets = %u\n", g_array_index(cf_info->interface_packet_counts, guint32, i)); + printf (" Number of packets = %u\n", packet_count); } } } -- cgit v1.2.1