summaryrefslogtreecommitdiff
path: root/capture_stop_conditions.c
diff options
context:
space:
mode:
authorChris Maynard <Christopher.Maynard@GTECH.COM>2013-08-29 18:15:13 +0000
committerChris Maynard <Christopher.Maynard@GTECH.COM>2013-08-29 18:15:13 +0000
commitbc654875f03fef8248b06b4bdc8bd26df0a50211 (patch)
treefc06b8170f66f0422810abf5eae8cbcaf3119703 /capture_stop_conditions.c
parent894ca4e904e86b6b9b687e9bfd0036cee70811c0 (diff)
downloadwireshark-bc654875f03fef8248b06b4bdc8bd26df0a50211.tar.gz
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 'capture_stop_conditions.c')
-rw-r--r--capture_stop_conditions.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/capture_stop_conditions.c b/capture_stop_conditions.c
index debf9f9247..386bf809bb 100644
--- a/capture_stop_conditions.c
+++ b/capture_stop_conditions.c
@@ -145,7 +145,7 @@ const char* CND_CLASS_CAPTURESIZE = "cnd_class_capturesize";
/* structure that contains user supplied data for this condition */
typedef struct _cnd_capturesize_dat{
- long max_capture_size;
+ guint64 max_capture_size;
}cnd_capturesize_dat;
/*
@@ -164,7 +164,9 @@ static condition* _cnd_constr_capturesize(condition* cnd, va_list ap){
if((data = (cnd_capturesize_dat*)g_malloc(sizeof(cnd_capturesize_dat))) == NULL)
return NULL;
/* initialize user data */
- data->max_capture_size = va_arg(ap, long);
+ data->max_capture_size = va_arg(ap, guint64);
+ if (data->max_capture_size > ((guint64)INT_MAX + 1))
+ data->max_capture_size = (guint64)INT_MAX + 1;
cnd_set_user_data(cnd, (void*)data);
return cnd;
} /* END _cnd_constr_capturesize() */
@@ -194,7 +196,7 @@ static gboolean _cnd_eval_capturesize(condition* cnd, va_list ap){
cnd_capturesize_dat* data = (cnd_capturesize_dat*)cnd_get_user_data(cnd);
/* check capturesize here */
if(data->max_capture_size == 0) return FALSE; /* 0 == infinite */
- if(va_arg(ap, long) >= data->max_capture_size){
+ if(va_arg(ap, guint64) >= data->max_capture_size){
return TRUE;
}
return FALSE;