[libnftnl PATCH 09/17] utils: Fix for wrong variable use in nftnl_assert_validate()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This worked by accident as all callers passed a local variable 'attr' as
parameter '_attr'.

Fixes: 7756d31990cd4 ("src: add assertion infrastructure to validate attribute types")
Signed-off-by: Phil Sutter <phil@xxxxxx>
---
 include/utils.h | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/utils.h b/include/utils.h
index ff76f77ebb351..eed61277595e2 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -37,9 +37,9 @@ void __nftnl_assert_fail(uint16_t attr, const char *filename, int line);
 #define nftnl_assert_validate(data, _validate_array, _attr, _data_len)		\
 ({										\
 	if (!data)								\
-		__nftnl_assert_fail(attr, __FILE__, __LINE__);			\
+		__nftnl_assert_fail(_attr, __FILE__, __LINE__);			\
 	if (_validate_array[_attr])						\
-		nftnl_assert(data, attr, _validate_array[_attr] == _data_len);	\
+		nftnl_assert(data, _attr, _validate_array[_attr] == _data_len);	\
 })
 
 void __nftnl_assert_attr_exists(uint16_t attr, uint16_t attr_max,
@@ -79,4 +79,7 @@ int nftnl_fprintf(FILE *fpconst, const void *obj, uint32_t cmd, uint32_t type,
 			  	     uint32_t cmd, uint32_t type,
 				     uint32_t flags));
 
+int nftnl_set_str_attr(const char **dptr, uint32_t *flags,
+		       uint16_t attr, const void *data, uint32_t data_len);
+
 #endif
-- 
2.43.0





[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux