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

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