config: Apply config value validation to logging_level option

Signed-off-by: Ken ICHIKAWA <ichikawa.ken@jp.fujitsu.com>
master
Ken ICHIKAWA 2013-06-04 14:00:31 +09:00 committed by Richard Cochran
parent 306f83e7b1
commit a92f42de38
1 changed files with 4 additions and 3 deletions

View File

@ -309,9 +309,10 @@ static enum parser_result parse_global_setting(const char *option,
*cfg->udp6_scope = u8; *cfg->udp6_scope = u8;
} else if (!strcmp(option, "logging_level")) { } else if (!strcmp(option, "logging_level")) {
if (1 != sscanf(value, "%d", &val) || r = get_ranged_int(value, &val,
val < PRINT_LEVEL_MIN || val > PRINT_LEVEL_MAX) PRINT_LEVEL_MIN, PRINT_LEVEL_MAX);
return BAD_VALUE; if (r != PARSED_OK)
return r;
if (!(cfg_ignore & CFG_IGNORE_PRINT_LEVEL)) { if (!(cfg_ignore & CFG_IGNORE_PRINT_LEVEL)) {
cfg->print_level = val; cfg->print_level = val;
} }