Commit 5a836f38 authored by Niels Möller's avatar Niels Möller
Browse files

(parser_parse_option): Require new line at

end of option-value pair, and warn for spurious tokens before the
end of line.

Rev: src/server_config.c:1.5
parent 44ce38dd
......@@ -230,16 +230,12 @@ parser_parse_option(struct parser_state *state,
for (option = parser->options; option->type != CONFIG_TYPE_NONE; option++)
{
if (strlen(option->name) == tokenizer->token_length
&& !memcmp(option->name, tokenizer->token, tokenizer->token_length))
if (config_tokenizer_looking_at (tokenizer, option->name))
{
uint32_t value = 0;
const uint8_t *data = NULL;
enum config_token_type type;
type = config_tokenizer_next(tokenizer);
if (type != TOK_STRING)
if (tokenizer->type != TOK_STRING)
err = EINVAL;
else
......@@ -269,6 +265,9 @@ parser_parse_option(struct parser_state *state,
data = arg;
break;
}
if (!config_tokenizer_eolp (tokenizer))
werror("%z:%i: Ignoring spurious data at end of line\n",
tokenizer->file, tokenizer->lineno);
}
if (err)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment