From 94fa461e0fe0c8004ee062c4d198dcae0bd29d68 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Mon, 7 Oct 2019 17:46:47 -0500 Subject: hscript: Lowercase the key, and don't parse an invalid key further --- hscript/script.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'hscript') diff --git a/hscript/script.cc b/hscript/script.cc index 40c5fbf..01c920d 100644 --- a/hscript/script.cc +++ b/hscript/script.cc @@ -10,6 +10,7 @@ * SPDX-License-Identifier: AGPL-3.0-only */ +#include #include #include #include "script.hh" @@ -104,6 +105,9 @@ const Script *Script::load(std::istream &sstream, ScriptOptions opts) { PARSER_ERROR("key '" + key + "' has no value") } + /* Normalise key to lower-case */ + std::transform(key.begin(), key.end(), key.begin(), ::tolower); + if(!is_key(key)) { /* Invalid key */ if(opts.test(StrictMode)) { @@ -111,6 +115,7 @@ const Script *Script::load(std::istream &sstream, ScriptOptions opts) { } else { PARSER_WARNING("key '" + key + "' is not defined") } + continue; } } -- cgit v1.2.3-70-g09d2