diff mbox series

[libnftnl,07/17] obj: Do not call nftnl_obj_set_data() with zero data_len

Message ID 20240319171224.18064-8-phil@nwl.cc
State Accepted
Headers show
Series obj: Introduce attribute policies | expand

Commit Message

Phil Sutter March 19, 2024, 5:12 p.m. UTC
Pass 'strlen() + 1' as length parameter when setting string attributes,
just like other string setters do.

Fixes: 5573d0146c1ae ("src: support for stateful objects")
Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 src/object.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/object.c b/src/object.c
index d3bfd16df532e..b518a675c2fb0 100644
--- a/src/object.c
+++ b/src/object.c
@@ -185,7 +185,7 @@  void nftnl_obj_set_u64(struct nftnl_obj *obj, uint16_t attr, uint64_t val)
 EXPORT_SYMBOL(nftnl_obj_set_str);
 void nftnl_obj_set_str(struct nftnl_obj *obj, uint16_t attr, const char *str)
 {
-	nftnl_obj_set_data(obj, attr, str, 0);
+	nftnl_obj_set_data(obj, attr, str, strlen(str) + 1);
 }
 
 EXPORT_SYMBOL(nftnl_obj_get_data);