]> git.ipfire.org Git - thirdparty/libnftnl.git/commitdiff
obj: Do not call nftnl_obj_set_data() with zero data_len
authorPhil Sutter <phil@nwl.cc>
Thu, 14 Mar 2024 15:44:34 +0000 (16:44 +0100)
committerPhil Sutter <phil@nwl.cc>
Wed, 10 Apr 2024 23:27:07 +0000 (01:27 +0200)
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

index d3bfd16df532e158c7f7e09be039999e8ea7a7b1..b518a675c2fb0d32b76257e29e8953529cc8be7e 100644 (file)
@@ -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);