mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 20:40:27 +00:00
host.cpp: validate parameters before assign
This commit is contained in:
10
src/host.cpp
10
src/host.cpp
@@ -705,6 +705,11 @@ static bool parse_params(char *optarg)
|
||||
char *save_ptr = nullptr;
|
||||
while ((item = strtok_r(optarg, ",", &save_ptr)) != nullptr) {
|
||||
char *key_cstr = item;
|
||||
if (!validate_param(key_cstr)) {
|
||||
LOG(LOG_LEVEL_ERROR) << "Unknown parameter: " << key_cstr << "\n";
|
||||
LOG(LOG_LEVEL_INFO) << "Type '" << uv_argv[0] << " --param help' for list.\n";
|
||||
return false;
|
||||
}
|
||||
if (strchr(item, '=') != nullptr) {
|
||||
char *val_cstr = strchr(item, '=') + 1;
|
||||
*strchr(item, '=') = '\0';
|
||||
@@ -712,11 +717,6 @@ static bool parse_params(char *optarg)
|
||||
} else {
|
||||
commandline_params[key_cstr] = string();
|
||||
}
|
||||
if (!validate_param(key_cstr)) {
|
||||
LOG(LOG_LEVEL_ERROR) << "Unknown parameter: " << key_cstr << "\n";
|
||||
LOG(LOG_LEVEL_INFO) << "Type '" << uv_argv[0] << " --param help' for list.\n";
|
||||
return false;
|
||||
}
|
||||
optarg = nullptr;
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user