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>
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);
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);