aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-02-22 03:03:34 +0000
committerGuy Harris <guy@alum.mit.edu>2012-02-22 03:03:34 +0000
commit46cb65974baa2883a10910baaa253ce9501b3b49 (patch)
treead5c90887a02ba07d1181b96ce373778a2a7440b
parent4a20fd003cda15ac210794ae4bd56c526f727ad0 (diff)
Handle the case where there are no IDBs before the first non-SHB/non-IDB
block, which could be the case even in a *valid* file (consider a file with an SHB, an NRB, an IDB, and a packet block, in that order); even if there's no IDB before the first packet block, that should be reported to the user as "interface N not less than interface count M", to more precisely indicate the problem. (Yes, the loop should probably keep going until it finds a packet block, not just a non-IDB block.) svn path=/trunk/; revision=41132
-rw-r--r--wiretap/pcapng.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c
index c46142a988..c79a08911f 100644
--- a/wiretap/pcapng.c
+++ b/wiretap/pcapng.c
@@ -1632,6 +1632,10 @@ pcapng_open(wtap *wth, int *err, gchar **err_info)
while(1){
bytes_read = pcapng_read_block(wth->fh, FALSE, &pn, &wblock, err, err_info);
wth->data_offset += bytes_read;
+ if (bytes_read == 0) {
+ pcapng_debug0("No more IDBs available...");
+ break;
+ }
if (bytes_read <= 0) {
pcapng_debug0("pcapng_open: couldn't read IDB");
*err = file_error(wth->fh, err_info);