Skip to contentSkip to conversation

tune2fs: Fix overflow of interval check

PATCH Applied Kazuya Mio 2 participants 2 messages Apr 19, 2011 – Jun 1, 2011

lore
Share & tools
lore

Kazuya Mio

author
#0 lore raw

PATCH 1/1 tune2fs: Fix overflow of interval check

Add the check of maximum check interval.
s_checkinterval is 32bit variable, so it cannot be set more than 2^32.

---
 misc/tune2fs.c |    6 ++++++
 1 file changed, 6 insertions(+)
misc/tune2fs.c +6 -0
index bcada11..625866f 100644
@@ -1705,6 +1705,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"),
Applied
#1 lore raw
Quoted 4 lines · Kazuya Mio

Add the check of maximum check interval.
s_checkinterval is 32bit variable, so it cannot be set more than 2^32.

Applied, thanks.

- Ted