aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-07-11 03:57:13 +0000
committerGuy Harris <guy@alum.mit.edu>2012-07-11 03:57:13 +0000
commit4de568eb10aeac4b6fcb2228a4ec16a7a30492bc (patch)
tree769f03f4592dab948ef35ec3f633682894645de0 /wiretap
parent447bc256c1bedf2f17a77c02395f4d9262be104e (diff)
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
Diffstat (limited to 'wiretap')
-rw-r--r--wiretap/pcapng.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c
index 5c58f8bc2f..a1bacfdea8 100644
--- a/wiretap/pcapng.c
+++ b/wiretap/pcapng.c
@@ -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) +