]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
mke2fs, tune2fs: Do not allow the reserved_ratio to be negative
authorTheodore Ts'o <tytso@mit.edu>
Fri, 6 Mar 2009 07:23:59 +0000 (02:23 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 6 Mar 2009 07:25:06 +0000 (02:25 -0500)
Add a check to make sure the argument to the -m option (which
specifies the reserved ratio) is greater than zero.

Addresses-Debian-Bug: #517015

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
misc/mke2fs.c
misc/tune2fs.c

index 746d9739d2181e22e98ac8f3bc738aa3085a05e9..15948e0977d7b0e5cff63d7a56d9ff010b8227c3 100644 (file)
@@ -1260,7 +1260,8 @@ static void PRS(int argc, char *argv[])
                        break;
                case 'm':
                        reserved_ratio = strtod(optarg, &tmp);
-                       if (reserved_ratio > 50 || *tmp) {
+                       if ( *tmp || reserved_ratio > 50 ||
+                            reserved_ratio < 0) {
                                com_err(program_name, 0,
                                        _("invalid reserved blocks percent - %s"),
                                        optarg);
index 887a7023042e7f53a1da0327dd747c8969027964..d7796119af81a624e2e66148edfbf552b7d8d0e8 100644 (file)
@@ -720,7 +720,8 @@ static void parse_tune2fs_options(int argc, char **argv)
                        break;
                case 'm':
                        reserved_ratio = strtod(optarg, &tmp);
-                       if (*tmp || reserved_ratio > 50) {
+                       if (*tmp || reserved_ratio > 50 ||
+                           reserved_ratio < 0) {
                                com_err(program_name, 0,
                                        _("bad reserved block ratio - %s"),
                                        optarg);