MXS-2859: Treat newlines in strings as errors
Allowing raw newlines in string values breaks configuration serialization.
This commit is contained in:
parent
f53faba795
commit
f6d848d58c
@ -2129,6 +2129,21 @@ static bool validate_object_json(json_t* json,
|
||||
|
||||
if (is_valid_resource_body(json))
|
||||
{
|
||||
if (json_t* parameters = mxs_json_pointer(json, MXS_JSON_PTR_PARAMETERS))
|
||||
{
|
||||
const char* key;
|
||||
json_t* value;
|
||||
|
||||
json_object_foreach(parameters, key, value)
|
||||
{
|
||||
if (json_is_string(value) && strchr(json_string_value(value), '\n'))
|
||||
{
|
||||
config_runtime_error("Parameter '%s' contains unescaped newlines", key);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(value = mxs_json_pointer(json, MXS_JSON_PTR_ID)))
|
||||
{
|
||||
config_runtime_error("Value not found: '%s'", MXS_JSON_PTR_ID);
|
||||
|
Loading…
x
Reference in New Issue
Block a user