diff options
author | Chris Maynard <Christopher.Maynard@GTECH.COM> | 2013-08-29 18:15:13 +0000 |
---|---|---|
committer | Chris Maynard <Christopher.Maynard@GTECH.COM> | 2013-08-29 18:15:13 +0000 |
commit | bc654875f03fef8248b06b4bdc8bd26df0a50211 (patch) | |
tree | fc06b8170f66f0422810abf5eae8cbcaf3119703 /dumpcap.c | |
parent | 894ca4e904e86b6b9b687e9bfd0036cee70811c0 (diff) |
Handle the 2GiB boundary case of the max filesize autostop condition properly so that we avoid overflow conditions and so that we ensure we don't capture more than 2GiB. Also, document the max filesize autostop value of 2GIB as well as indicating that it's truly GiB and not GB.
This fixes the problem reported on ask: http://ask.wireshark.org/questions/23891/wireshark-wont-run-with-multiple-capture-files
#BACKPORT(1.10) ... not sure about 1.8?
svn path=/trunk/; revision=51576
Diffstat (limited to 'dumpcap.c')
-rw-r--r-- | dumpcap.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -3575,9 +3575,13 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct /* initialize capture stop (and alike) conditions */ init_capture_stop_conditions(); /* create stop conditions */ - if (capture_opts->has_autostop_filesize) + if (capture_opts->has_autostop_filesize) { + if (capture_opts->autostop_filesize > (((guint32)INT_MAX + 1) / 1024)) { + capture_opts->autostop_filesize = ((guint32)INT_MAX + 1) / 1024; + } cnd_autostop_size = - cnd_new(CND_CLASS_CAPTURESIZE,(long)capture_opts->autostop_filesize * 1024); + cnd_new(CND_CLASS_CAPTURESIZE, (guint64)capture_opts->autostop_filesize * 1024); + } if (capture_opts->has_autostop_duration) cnd_autostop_duration = cnd_new(CND_CLASS_TIMEOUT,(gint32)capture_opts->autostop_duration); @@ -3678,7 +3682,7 @@ capture_loop_start(capture_options *capture_opts, gboolean *stats_known, struct /* check capture size condition */ if (cnd_autostop_size != NULL && - cnd_eval(cnd_autostop_size, (guint32)global_ld.bytes_written)) { + cnd_eval(cnd_autostop_size, global_ld.bytes_written)) { /* Capture size limit reached, do we have another file? */ if (!do_file_switch_or_stop(capture_opts, cnd_autostop_files, cnd_autostop_size, cnd_file_duration)) |