Index: src/option_handler_rules.cc =================================================================== --- src/option_handler_rules.cc (revision 854) +++ src/option_handler_rules.cc (working copy) @@ -320,7 +320,7 @@ else if (arg == "mincost") value = torrent::ConnectionManager::iptos_mincost; - else if (!utils::Variable::string_to_value_unit_nothrow(arg.c_str(), &value, 16, 0)) + else if (!utils::Variable::string_to_value_unit_nothrow(arg.c_str(), &value, 16, 1)) throw torrent::input_error("Invalid TOS identifier."); cm->set_priority(value); Index: src/utils/variable.cc =================================================================== --- src/utils/variable.cc (revision 854) +++ src/utils/variable.cc (working copy) @@ -66,6 +66,9 @@ const char* Variable::string_to_value_unit(const char* pos, value_type* value, int base, int unit) { + if (unit <= 0) + throw torrent::input_error("Variable::string_to_value_unit(...) received unit <= 0."); + char* last; *value = strtoll(pos, &last, base);