Don't ask for information about an interface greater than the maximum

interface for which we have information.

Fixes bug 7467.

Should also cause an error message, rather than an unreadable capture
file, to be produced for the cases in bug 7381.  (This isn't a fix for
bug 7381; it's arguably an improvement, in the sense that a circuit
breaker tripping or a fuse blowing for a short circuit is an improvement
over a fire starting, but it's not a *fix*, any more than a circuit
break or fuse *fixes* the short circuit.)

#BACKPORT

svn path=/trunk/; revision=43657
This commit is contained in:
Guy Harris 2012-07-11 03:57:13 +00:00
parent 447bc256c1
commit 4de568eb10
1 changed files with 7 additions and 0 deletions

View File

@ -3158,6 +3158,13 @@ pcapng_write_enhanced_packet_block(wtap_dumper *wdh,
* Split the 64-bit timestamp into two 32-bit pieces, using
* the time stamp resolution for the interface.
*/
if (epb.interface_id >= wdh->number_of_interfaces) {
/*
* Our caller is doing something bad.
*/
*err = WTAP_ERR_INTERNAL;
return FALSE;
}
int_data = g_array_index(wdh->interface_data, wtapng_if_descr_t,
epb.interface_id);
ts = (((guint64)phdr->ts.secs) * int_data.time_units_per_second) +