From patchwork Mon May 28 16:50:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Sutter X-Patchwork-Id: 921628 X-Patchwork-Delegate: pablo@netfilter.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netfilter-devel-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=nwl.cc Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40vjZD679fz9rxs for ; Tue, 29 May 2018 02:52:04 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S940464AbeE1QwE (ORCPT ); Mon, 28 May 2018 12:52:04 -0400 Received: from orbyte.nwl.cc ([151.80.46.58]:34228 "EHLO orbyte.nwl.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932206AbeE1QwD (ORCPT ); Mon, 28 May 2018 12:52:03 -0400 Received: from localhost ([::1]:49504 helo=tatos) by orbyte.nwl.cc with esmtp (Exim 4.90_1) (envelope-from ) id 1fNLNK-0002Om-PJ; Mon, 28 May 2018 18:52:02 +0200 From: Phil Sutter To: Pablo Neira Ayuso Cc: netfilter-devel@vger.kernel.org Subject: [nft PATCH v2 03/14] JSON: Disallow non-array concat expression values Date: Mon, 28 May 2018 18:50:58 +0200 Message-Id: <20180528165109.15992-4-phil@nwl.cc> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528165109.15992-1-phil@nwl.cc> References: <20180528165109.15992-1-phil@nwl.cc> Sender: netfilter-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org Concat expressions with just a single element don't make sense, so there's no point in supporting a shorter syntax for this. Signed-off-by: Phil Sutter --- src/parser_json.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/parser_json.c b/src/parser_json.c index 993368f04ea4a..60929386be4da 100644 --- a/src/parser_json.c +++ b/src/parser_json.c @@ -910,9 +910,7 @@ static struct expr *json_parse_concat_expr(struct json_ctx *ctx, json_t *value; size_t index; - if (json_is_object(root)) - return json_parse_primary_expr(ctx, root); - else if (!json_is_array(root)) { + if (!json_is_array(root)) { json_error(ctx, "Unexpected concat object type %s.", json_typename(root)); return NULL;