(process_options): Test the "i" and "arg" variables thoroughly before

making use of either one of them.
This commit is contained in:
John Wiegley 2005-07-15 00:55:45 +00:00
parent f8610dbfd7
commit c29eed174d

View file

@ -182,10 +182,11 @@ void config_t::process_options(const std::string& command,
if (*i == "--")
break;
regexps_to_predicate(*this, command, arg, i++, true,
(command == "b" && ! show_subtotal &&
display_predicate.empty()));
if (i != args_end)
if (i != arg)
regexps_to_predicate(*this, command, arg, i, true,
(command == "b" && ! show_subtotal &&
display_predicate.empty()));
if (i != args_end && ++i != args_end)
regexps_to_predicate(*this, command, i, args_end);
}