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>
This commit is contained in:
Guy Harris 2016-09-25 11:21:57 -07:00
parent 79ae8c1d07
commit aeb112fde8
1 changed files with 4 additions and 1 deletions

View File

@ -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);
}
}
}