Blame SOURCES/0004-ruleset-Avoid-reading-garbage-in-nftnl_ruleset_cb.patch

589a38
From 3620cf73a4e58e08891d3188a6a4c06a16546fe0 Mon Sep 17 00:00:00 2001
589a38
From: Phil Sutter <psutter@redhat.com>
589a38
Date: Mon, 22 Jul 2019 17:34:25 +0200
589a38
Subject: [PATCH] ruleset: Avoid reading garbage in nftnl_ruleset_cb()
589a38
589a38
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1510538
589a38
Upstream Status: libnftnl commit dbaf6ea8f6a1a
589a38
589a38
commit dbaf6ea8f6a1a1e7f1d5abc2e4e2fef891c471b7
589a38
Author: Phil Sutter <phil@nwl.cc>
589a38
Date:   Thu Dec 14 20:40:23 2017 +0100
589a38
589a38
    ruleset: Avoid reading garbage in nftnl_ruleset_cb()
589a38
589a38
    If nftnl_ruleset_json_parse() is called with arg == NULL, ctx.data is
589a38
    left uninitialized and will later be used in nftnl_ruleset_cb(). Avoid
589a38
    this by using a C99-style initializer for 'ctx' which sets all omitted
589a38
    fields to zero.
589a38
589a38
    Signed-off-by: Phil Sutter <phil@nwl.cc>
589a38
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
589a38
---
589a38
 src/ruleset.c | 10 +++++-----
589a38
 1 file changed, 5 insertions(+), 5 deletions(-)
589a38
589a38
diff --git a/src/ruleset.c b/src/ruleset.c
589a38
index 3de9b87..cf86ca6 100644
589a38
--- a/src/ruleset.c
589a38
+++ b/src/ruleset.c
589a38
@@ -519,11 +519,11 @@ static int nftnl_ruleset_json_parse(const void *json,
589a38
 	json_error_t error;
589a38
 	int i, len;
589a38
 	const char *key;
589a38
-	struct nftnl_parse_ctx ctx;
589a38
-
589a38
-	ctx.cb = cb;
589a38
-	ctx.format = type;
589a38
-	ctx.flags = 0;
589a38
+	struct nftnl_parse_ctx ctx = {
589a38
+		.cb = cb,
589a38
+		.format = type,
589a38
+		.flags = 0,
589a38
+	};
589a38
 
589a38
 	ctx.set_list = nftnl_set_list_alloc();
589a38
 	if (ctx.set_list == NULL)
589a38
-- 
589a38
1.8.3.1
589a38