forked from osmocom/wireshark
Don't assume we have interface information.
Not all capture file formats provide interface information. Check whether we have it, and don't fail if we don't have any. (Note that the current version of the pcapng specification in the Git repository does not require that there be at least one IDB in a file, only that there must be an IDB for each interface to which other blocks in a file refers.) Change-Id: Ia796f639ed3a8cb21e1dbe9b2bc6b4b66c7be479 Reviewed-on: https://code.wireshark.org/review/10220 Reviewed-by: Guy Harris <guy@alum.mit.edu>daniel/osmux
parent
ce38df527f
commit
5ed7a401bb
11
capinfos.c
11
capinfos.c
|
@ -685,7 +685,7 @@ print_stats(const gchar *filename, capture_info *cf_info)
|
|||
printf ("Capture application: %s\n", cf_info->usr_appl);
|
||||
}
|
||||
|
||||
if (cap_file_idb) {
|
||||
if (cap_file_idb && cf_info->num_interfaces != 0) {
|
||||
guint i;
|
||||
g_assert(cf_info->num_interfaces == cf_info->idb_info_strings->len);
|
||||
printf ("Number of interfaces in file: %u\n", cf_info->num_interfaces);
|
||||
|
@ -1065,9 +1065,7 @@ process_cap_file(wtap *wth, const char *filename)
|
|||
|
||||
idb_info = wtap_file_get_idb_info(wth);
|
||||
|
||||
/* every file should have at least one IDB, or else it's an internal programming error */
|
||||
g_assert(idb_info->interface_data != NULL);
|
||||
g_assert(idb_info->interface_data->len > 0);
|
||||
|
||||
cf_info.num_interfaces = idb_info->interface_data->len;
|
||||
cf_info.interface_ids = g_new0(guint32, cf_info.num_interfaces);
|
||||
|
@ -1152,7 +1150,12 @@ process_cap_file(wtap *wth, const char *filename)
|
|||
}
|
||||
else {
|
||||
/* it's for interface_id 0 */
|
||||
cf_info.interface_ids[0] += 1;
|
||||
if (cf_info.num_interfaces != 0) {
|
||||
cf_info.interface_ids[0] += 1;
|
||||
}
|
||||
else {
|
||||
cf_info.pkt_interface_id_unknown += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue