mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-10 15:45:36 +01:00
util: Disallow network-qualified command line options
Previously these were allowed but ignored.
This commit is contained in:
@@ -311,21 +311,18 @@ bool ArgsManager::ParseParameters(int argc, const char* const argv[], std::strin
|
||||
std::string section;
|
||||
util::SettingsValue value = InterpretOption(section, key, val);
|
||||
Optional<unsigned int> flags = GetArgFlags('-' + key);
|
||||
if (flags) {
|
||||
if (!CheckValid(key, value, *flags, error)) {
|
||||
return false;
|
||||
}
|
||||
// Weird behavior preserved for backwards compatibility: command
|
||||
// line options with section prefixes are allowed but ignored. It
|
||||
// would be better if these options triggered the Invalid parameter
|
||||
// error below.
|
||||
if (section.empty()) {
|
||||
m_settings.command_line_options[key].push_back(value);
|
||||
}
|
||||
} else {
|
||||
error = strprintf("Invalid parameter -%s", key);
|
||||
|
||||
// Unknown command line options and command line options with dot
|
||||
// characters (which are returned from InterpretOption with nonempty
|
||||
// section strings) are not valid.
|
||||
if (!flags || !section.empty()) {
|
||||
error = strprintf("Invalid parameter %s", argv[i]);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CheckValid(key, value, *flags, error)) return false;
|
||||
|
||||
m_settings.command_line_options[key].push_back(value);
|
||||
}
|
||||
|
||||
// we do not allow -includeconf from command line
|
||||
|
||||
Reference in New Issue
Block a user