From 844541f4c43c2469b9955b78480cbe36fde653d0 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Fri, 10 Jun 2016 14:13:00 +0200 Subject: src: assert when setting unknown attributes If this attribute is not supported by the library, we should rise an assertion so the client knows something is wrong, instead of silently going through. The only case I can think may hit this problem is version mismatch between library and tools. This should not ever really happen, so better bail out from the library itself in this case. Signed-off-by: Pablo Neira Ayuso --- src/set.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/set.c') diff --git a/src/set.c b/src/set.c index dbea93b..d2467e4 100644 --- a/src/set.c +++ b/src/set.c @@ -116,9 +116,7 @@ static uint32_t nftnl_set_validate[NFTNL_SET_MAX + 1] = { void nftnl_set_set_data(struct nftnl_set *s, uint16_t attr, const void *data, uint32_t data_len) { - if (attr > NFTNL_SET_MAX) - return; - + nftnl_assert_attr_exists(attr, NFTNL_SET_MAX); nftnl_assert_validate(data, nftnl_set_validate, attr, data_len); switch(attr) { -- cgit v1.2.3