Blame SOURCES/0009-src-Fix-for-reading-garbage-in-nftnl_chain-getters.patch

ecfd6a
From 6854ec003b42cf02d4b40c0942d49ede9f6d94c0 Mon Sep 17 00:00:00 2001
ecfd6a
From: Phil Sutter <psutter@redhat.com>
ecfd6a
Date: Wed, 19 Feb 2020 12:00:31 +0100
ecfd6a
Subject: [PATCH] src: Fix for reading garbage in nftnl_chain getters
ecfd6a
ecfd6a
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1758673
ecfd6a
Upstream Status: libnftnl commit 629ee38dca486
ecfd6a
ecfd6a
commit 629ee38dca48651bc8c0eedf2f3a0066a6c0aa5b
ecfd6a
Author: Phil Sutter <phil@nwl.cc>
ecfd6a
Date:   Fri Feb 14 18:20:29 2020 +0100
ecfd6a
ecfd6a
    src: Fix for reading garbage in nftnl_chain getters
ecfd6a
ecfd6a
    In {s,u}{32,64} type getters nftnl_assert() is called to make sure
ecfd6a
    returned data length matches expectations. Therefore all attributes must
ecfd6a
    set data_len, which NFTNL_CHAIN_DEVICES didn't.
ecfd6a
ecfd6a
    While being at it, do the same change for NFTNL_FLOWTABLE_DEVICES as
ecfd6a
    well to make code a bit more consistent although the problem was fixed
ecfd6a
    for flowtables with commit f8eed54150fd4 ("flowtable: Fix for reading
ecfd6a
    garbage") already (but in the other direction).
ecfd6a
ecfd6a
    Fixes: e3ac19b5ec162 ("chain: multi-device support")
ecfd6a
    Signed-off-by: Phil Sutter <phil@nwl.cc>
ecfd6a
---
ecfd6a
 src/chain.c     | 1 +
ecfd6a
 src/flowtable.c | 1 +
ecfd6a
 2 files changed, 2 insertions(+)
ecfd6a
ecfd6a
diff --git a/src/chain.c b/src/chain.c
ecfd6a
index b9a16fc..6e90763 100644
ecfd6a
--- a/src/chain.c
ecfd6a
+++ b/src/chain.c
ecfd6a
@@ -365,6 +365,7 @@ const void *nftnl_chain_get_data(const struct nftnl_chain *c, uint16_t attr,
ecfd6a
 		*data_len = strlen(c->dev) + 1;
ecfd6a
 		return c->dev;
ecfd6a
 	case NFTNL_CHAIN_DEVICES:
ecfd6a
+		*data_len = 0;
ecfd6a
 		return &c->dev_array[0];
ecfd6a
 	}
ecfd6a
 	return NULL;
ecfd6a
diff --git a/src/flowtable.c b/src/flowtable.c
ecfd6a
index 9ba3b6d..bf3e443 100644
ecfd6a
--- a/src/flowtable.c
ecfd6a
+++ b/src/flowtable.c
ecfd6a
@@ -231,6 +231,7 @@ const void *nftnl_flowtable_get_data(const struct nftnl_flowtable *c,
ecfd6a
 		*data_len = sizeof(int32_t);
ecfd6a
 		return &c->family;
ecfd6a
 	case NFTNL_FLOWTABLE_DEVICES:
ecfd6a
+		*data_len = 0;
ecfd6a
 		return &c->dev_array[0];
ecfd6a
 	case NFTNL_FLOWTABLE_SIZE:
ecfd6a
 		*data_len = sizeof(int32_t);
ecfd6a
-- 
ecfd6a
1.8.3.1
ecfd6a