summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2021-03-09 13:29:30 +0100
committerPhil Sutter <phil@nwl.cc>2021-03-15 12:23:07 +0100
commit636fd0daf4890a785e8b165c5ce2c602e5361fcb (patch)
treeec4d67225bae903c21e633e4e16f27a0fc15283a /src
parentf072e2e68b460acdb4b6370f552a7c5a48ddd66f (diff)
object: Fix for wrong parameter passed to snprintf callback
Instead of the remaining buffer length, the used buffer length was passed to object's snprintf callback (and the final snprintf call). Fixes: 5573d0146c1ae ("src: support for stateful objects") Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'src')
-rw-r--r--src/object.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/object.c b/src/object.c
index 008bade..46e7916 100644
--- a/src/object.c
+++ b/src/object.c
@@ -396,11 +396,11 @@ static int nftnl_obj_snprintf_dflt(char *buf, size_t size,
SNPRINTF_BUFFER_SIZE(ret, remain, offset);
if (obj->ops) {
- ret = obj->ops->snprintf(buf + offset, offset, type, flags,
+ ret = obj->ops->snprintf(buf + offset, remain, type, flags,
obj);
SNPRINTF_BUFFER_SIZE(ret, remain, offset);
}
- ret = snprintf(buf + offset, offset, "]");
+ ret = snprintf(buf + offset, remain, "]");
SNPRINTF_BUFFER_SIZE(ret, remain, offset);
return offset;