Avoid a division by zero due to overflow.

This should fix the crash in
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7266

svn path=/trunk/; revision=44141
This commit is contained in:
Michael Tüxen 2012-07-30 20:53:42 +00:00
parent 5bdfe5a5e8
commit afe900aa9f
1 changed files with 2 additions and 2 deletions

View File

@ -3168,8 +3168,8 @@ pcapng_write_enhanced_packet_block(wtap_dumper *wdh,
}
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) +
(phdr->ts.nsecs / (1000000000/int_data.time_units_per_second));
ts = ((guint64)phdr->ts.secs) * int_data.time_units_per_second +
(((guint64)phdr->ts.nsecs) * int_data.time_units_per_second) / 1000000000;
epb.timestamp_high = (guint32)(ts >> 32);
epb.timestamp_low = (guint32)ts;
epb.captured_len = phdr->caplen + phdr_len;