Whamcloud - gitweb
tune2fs: Fix overflow of interval check
authorKazuya Mio <k-mio@sx.jp.nec.com>
Mon, 18 Apr 2011 20:11:39 +0000 (20:11 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 1 Jun 2011 00:07:38 +0000 (20:07 -0400)
Add the check of maximum check interval.
s_checkinterval is 32bit variable, so it cannot be set more than 2^32.

Signed-off-by: Kazuya Mio <k-mio@sx.jp.nec.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/tune2fs.c

index 9d2b12c..7d5c092 100644 (file)
@@ -1701,6 +1701,12 @@ retry_open:
                printf(_("Setting reserved blocks gid to %lu\n"), resgid);
        }
        if (i_flag) {
+               if (interval >= (1ULL << 32)) {
+                       com_err(program_name, 0,
+                               _("interval between checks is too big (%lu)"),
+                               interval);
+                       exit(1);
+               }
                sb->s_checkinterval = interval;
                ext2fs_mark_super_dirty(fs);
                printf(_("Setting interval between checks to %lu seconds\n"),