summaryrefslogtreecommitdiff
path: root/capinfos.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2016-09-25 11:21:57 -0700
committerGuy Harris <guy@alum.mit.edu>2016-09-25 18:22:30 +0000
commitaeb112fde85197d4bf665d513d333ace0896c4f8 (patch)
treec9e8831244af3da622d6888f4090bcfefa883818 /capinfos.c
parent79ae8c1d07fe777a175269ed49d2adee9c1d575b (diff)
downloadwireshark-aeb112fde85197d4bf665d513d333ace0896c4f8.tar.gz
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 <guy@alum.mit.edu>
Diffstat (limited to 'capinfos.c')
-rw-r--r--capinfos.c5
1 files changed, 4 insertions, 1 deletions
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);
}
}
}