1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-30 19:57:59 +02:00

fromJSON/fromTOML: throw if string contains null byte

This commit is contained in:
Philipp Otterbein 2024-12-07 20:46:11 +01:00
parent ab5a9cf2db
commit 3a9d64b8e3
12 changed files with 60 additions and 3 deletions

View file

@ -50,6 +50,7 @@ class JSONSax : nlohmann::json_sax<json> {
public:
void key(string_t & name, EvalState & state)
{
forceNoNullByte(name);
attrs.insert_or_assign(state.symbols.create(name), &value(state));
}
};
@ -122,6 +123,7 @@ public:
bool string(string_t & val) override
{
forceNoNullByte(val);
rs->value(state).mkString(val);
rs->add();
return true;