summaryrefslogtreecommitdiff
path: root/src/json.c
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-07-02 15:06:24 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-07-02 15:06:24 +0200
commit8b52d9f5f177ce76b9ebecadd70c6dbbf07a20c6 (patch)
tree1ce43ea5c48e09dbbdb0d5659acc2c9f81cce032 /src/json.c
parent5b112482fbdb0351487a7af592ae901e20ec45c1 (diff)
downloademacs-8b52d9f5f177ce76b9ebecadd70c6dbbf07a20c6.tar.gz
Allow NUL characters in JSON input
* src/json.c (Fjson_parse_string, Fjson_parse_buffer): Allow NUL characters in JSON (bug#48274).
Diffstat (limited to 'src/json.c')
-rw-r--r--src/json.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/json.c b/src/json.c
index 763f463aa4e..9a455f507b4 100644
--- a/src/json.c
+++ b/src/json.c
@@ -975,7 +975,7 @@ usage: (json-parse-string STRING &rest ARGS) */)
json_error_t error;
json_t *object
- = json_loads (SSDATA (encoded), JSON_DECODE_ANY, &error);
+ = json_loads (SSDATA (encoded), JSON_DECODE_ANY | JSON_ALLOW_NUL, &error);
if (object == NULL)
json_parse_error (&error);
@@ -1071,7 +1071,9 @@ usage: (json-parse-buffer &rest args) */)
json_error_t error;
json_t *object
= json_load_callback (json_read_buffer_callback, &data,
- JSON_DECODE_ANY | JSON_DISABLE_EOF_CHECK,
+ JSON_DECODE_ANY
+ | JSON_DISABLE_EOF_CHECK
+ | JSON_ALLOW_NUL,
&error);
if (object == NULL)