If you mark all frames, then unmark all frames "marked_count" overflows.
authorGerald Combs <gerald@wireshark.org>
Wed, 18 Aug 2004 21:05:38 +0000 (21:05 -0000)
committerGerald Combs <gerald@wireshark.org>
Wed, 18 Aug 2004 21:05:38 +0000 (21:05 -0000)
Keep this from happening.

svn path=/trunk/; revision=11771

file.c

diff --git a/file.c b/file.c
index 0b8ea8307027b888bca872965fde1b97cdf42a79..b0e68906109ad66a95c8126738fa4d41ba82f869 100644 (file)
--- a/file.c
+++ b/file.c
@@ -2777,7 +2777,8 @@ void
 mark_frame(capture_file *cf, frame_data *frame)
 {
   frame->flags.marked = TRUE;
-  cf->marked_count++;
+  if (cf->count > cf->marked_count)
+    cf->marked_count++;
 }
 
 /*
@@ -2787,7 +2788,8 @@ void
 unmark_frame(capture_file *cf, frame_data *frame)
 {
   frame->flags.marked = FALSE;
-  cf->marked_count--;
+  if (cf->marked_count > 0)
+    cf->marked_count--;
 }
 
 typedef struct {