From 25ccb4587de81e1b348e4e2f5404e70097ea8ec9 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Mon, 28 May 2018 18:51:01 +0200 Subject: JSON: Review set elem expressions * There is no need to prefix element-specific properties with 'elem_', they can't conflict. * In json_parse_set_stmt(), searching for above properties is pointless since that's already done by called function. * Fix potential NULL-pointer deref in json_parse_set_elem_expr_stmt(): json_parse_flagged_expr() may return NULL. Signed-off-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso --- src/json.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/json.c') diff --git a/src/json.c b/src/json.c index e31e3132..83366df8 100644 --- a/src/json.c +++ b/src/json.c @@ -508,13 +508,13 @@ json_t *set_elem_expr_json(const struct expr *expr, struct output_ctx *octx) root = json_pack("{s:o}", "val", root); if (expr->timeout) - json_object_set_new(root, "elem_timeout", + json_object_set_new(root, "timeout", json_integer(expr->timeout / 1000)); if (expr->expiration) - json_object_set_new(root, "elem_expires", + json_object_set_new(root, "expires", json_integer(expr->expiration / 1000)); if (expr->comment) - json_object_set_new(root, "elem_comment", + json_object_set_new(root, "comment", json_string(expr->comment)); return json_pack("{s:o}", "elem", root); } -- cgit v1.2.3