From ec38a982f406ad7db8e95bcb0fc61ecaaa71ea0f Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Tue, 8 Dec 2015 11:30:38 +0100 Subject: [PATCH] src/utils_format_json.c: Check return value of json_escape_string(). CID: 37946 --- src/utils_format_json.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utils_format_json.c b/src/utils_format_json.c index 23a0fdf0..020d80be 100644 --- a/src/utils_format_json.c +++ b/src/utils_format_json.c @@ -262,8 +262,12 @@ static int meta_data_keys_to_json (char *buffer, size_t buffer_size, /* {{{ */ if (meta_data_get_string (meta, key, &value) == 0) { char temp[512] = ""; - json_escape_string (temp, sizeof (temp), value); + + status = json_escape_string (temp, sizeof (temp), value); sfree (value); + if (status != 0) + return status; + BUFFER_ADD (",\"%s\":%s", key, temp); } } -- 2.30.2