Netfilter-Devel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH nft] parser_json: fix crash on insert rule to bad references
@ 2019-09-10 13:46 Eric Garver
  2019-09-10 16:25 ` Phil Sutter
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Garver @ 2019-09-10 13:46 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Pablo Neira Ayuso, Phil Sutter

Pass the location via the handle so the error leg in
erec_print_list() can reference it. Applies to invalid references
to tables, chains, and indexes.

Fixes: 586ad210368b ("libnftables: Implement JSON parser")
Signed-off-by: Eric Garver <eric@garver.life>
---
 src/parser_json.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/parser_json.c b/src/parser_json.c
index 8ca07d717b13..183d9c972181 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -3258,7 +3258,11 @@ static struct cmd *json_parse_cmd_add(struct json_ctx *ctx,
 static struct cmd *json_parse_cmd_replace(struct json_ctx *ctx,
 					  json_t *root, enum cmd_ops op)
 {
-	struct handle h = { 0 };
+	struct handle h = {
+		.table.location = *int_loc,
+		.chain.location = *int_loc,
+		.index.location = *int_loc,
+	};
 	json_t *tmp, *value;
 	const char *family;
 	struct rule *rule;
-- 
2.20.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH nft] parser_json: fix crash on insert rule to bad references
  2019-09-10 13:46 [PATCH nft] parser_json: fix crash on insert rule to bad references Eric Garver
@ 2019-09-10 16:25 ` Phil Sutter
  0 siblings, 0 replies; 2+ messages in thread
From: Phil Sutter @ 2019-09-10 16:25 UTC (permalink / raw)
  To: Eric Garver; +Cc: netfilter-devel, Pablo Neira Ayuso

On Tue, Sep 10, 2019 at 09:46:15AM -0400, Eric Garver wrote:
> Pass the location via the handle so the error leg in
> erec_print_list() can reference it. Applies to invalid references
> to tables, chains, and indexes.
> 
> Fixes: 586ad210368b ("libnftables: Implement JSON parser")
> Signed-off-by: Eric Garver <eric@garver.life>

Also applied, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-10 13:46 [PATCH nft] parser_json: fix crash on insert rule to bad references Eric Garver
2019-09-10 16:25 ` Phil Sutter

Netfilter-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netfilter-devel/0 netfilter-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netfilter-devel netfilter-devel/ https://lore.kernel.org/netfilter-devel \
		netfilter-devel@vger.kernel.org netfilter-devel@archiver.kernel.org
	public-inbox-index netfilter-devel


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netfilter-devel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox