#include "base/array.hpp"
#include "base/objectlock.hpp"
#include "base/convert.hpp"
+#include "base/utility.hpp"
#include <bitset>
#include <boost/exception_ptr.hpp>
#include <cstdint>
ObjectLock olock(ns);
for (const Namespace::Pair& kv : ns) {
- stateMachine.Key(kv.first);
+ stateMachine.Key(Utility::ValidateUTF8(kv.first));
Encode(stateMachine, kv.second->Get());
}
ObjectLock olock(dict);
for (const Dictionary::Pair& kv : dict) {
- stateMachine.Key(kv.first);
+ stateMachine.Key(Utility::ValidateUTF8(kv.first));
Encode(stateMachine, kv.second);
}
break;
case ValueString:
- stateMachine.Strng(value.Get<String>());
+ stateMachine.Strng(Utility::ValidateUTF8(value.Get<String>()));
break;
case ValueObject:
Value icinga::JsonDecode(const String& data)
{
+ String sanitized (Utility::ValidateUTF8(data));
+
JsonSax stateMachine;
- nlohmann::json::sax_parse(data.Begin(), data.End(), &stateMachine);
+ nlohmann::json::sax_parse(sanitized.Begin(), sanitized.End(), &stateMachine);
return stateMachine.GetResult();
}