diff --git a/SOURCES/0041-json-init-parser-state-for-every-new-buffer-file.patch b/SOURCES/0041-json-init-parser-state-for-every-new-buffer-file.patch new file mode 100644 index 0000000..2906409 --- /dev/null +++ b/SOURCES/0041-json-init-parser-state-for-every-new-buffer-file.patch @@ -0,0 +1,46 @@ +From 2b4da3af37ac10d96650da1b8642f82a3aa92e30 Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Sat, 20 Feb 2021 09:52:59 +0100 +Subject: [PATCH] json: init parser state for every new buffer/file + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1930873 +Upstream Status: nftables commit 267338ec39234 + +commit 267338ec392346ef55ed51509e5f8e8354d6c19a +Author: Eric Garver +Date: Fri Feb 19 10:11:26 2021 -0500 + + json: init parser state for every new buffer/file + + Otherwise invalid error states cause subsequent json parsing to fail + when it should not. + + Signed-off-by: Eric Garver + Signed-off-by: Phil Sutter +--- + src/parser_json.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/parser_json.c b/src/parser_json.c +index 986f128..662bb4b 100644 +--- a/src/parser_json.c ++++ b/src/parser_json.c +@@ -3777,6 +3777,7 @@ int nft_parse_json_buffer(struct nft_ctx *nft, const char *buf, + }; + int ret; + ++ parser_init(nft, nft->state, msgs, cmds, nft->top_scope); + nft->json_root = json_loads(buf, 0, NULL); + if (!nft->json_root) + return -EINVAL; +@@ -3805,6 +3806,7 @@ int nft_parse_json_filename(struct nft_ctx *nft, const char *filename, + json_error_t err; + int ret; + ++ parser_init(nft, nft->state, msgs, cmds, nft->top_scope); + nft->json_root = json_load_file(filename, 0, &err); + if (!nft->json_root) + return -EINVAL; +-- +1.8.3.1 + diff --git a/SPECS/nftables.spec b/SPECS/nftables.spec index 72c11bb..57a7d1f 100644 --- a/SPECS/nftables.spec +++ b/SPECS/nftables.spec @@ -1,5 +1,5 @@ %define rpmversion 0.9.3 -%define specrelease 17%{?dist} +%define specrelease 18%{?dist} Name: nftables Version: %{rpmversion} @@ -57,6 +57,7 @@ Patch37: 0037-proto-Fix-ARP-header-field-ordering.patch Patch38: 0038-json-echo-Speedup-seqnum_to_json.patch Patch39: 0039-json-Fix-seqnum_to_json-functionality.patch Patch40: 0040-json-don-t-leave-dangling-pointers-on-hlist.patch +Patch41: 0041-json-init-parser-state-for-every-new-buffer-file.patch BuildRequires: autogen BuildRequires: autoconf @@ -173,6 +174,9 @@ touch -r %{SOURCE2} $RPM_BUILD_ROOT/%{python3_sitelib}/nftables/nftables.py %{python3_sitelib}/nftables/ %changelog +* Sat Feb 20 2021 Phil Sutter [0.9.3-18.el8] +- json: init parser state for every new buffer/file (Phil Sutter) [1930873] + * Tue Jan 12 2021 Phil Sutter [0.9.3-17.el8] - json: don't leave dangling pointers on hlist (Phil Sutter) [1900565] - json: Fix seqnum_to_json() functionality (Phil Sutter) [1900565]