diff options
Diffstat (limited to 'src/table.c')
-rw-r--r-- | src/table.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/table.c b/src/table.c index 80f85df..4d8176c 100644 --- a/src/table.c +++ b/src/table.c @@ -378,6 +378,9 @@ static int nftnl_table_cmd_snprintf(char *buf, size_t size, { int ret, remain = size, offset = 0; + if (size) + buf[0] = '\0'; + ret = nftnl_cmd_header_snprintf(buf + offset, remain, cmd, type, flags); SNPRINTF_BUFFER_SIZE(ret, remain, offset); @@ -403,6 +406,9 @@ static int nftnl_table_cmd_snprintf(char *buf, size_t size, int nftnl_table_snprintf(char *buf, size_t size, const struct nftnl_table *t, uint32_t type, uint32_t flags) { + if (size) + buf[0] = '\0'; + return nftnl_table_cmd_snprintf(buf, size, t, nftnl_flag2cmd(flags), type, flags); } @@ -411,6 +417,9 @@ EXPORT_SYMBOL(nftnl_table_snprintf); static int nftnl_table_do_snprintf(char *buf, size_t size, const void *t, uint32_t cmd, uint32_t type, uint32_t flags) { + if (size) + buf[0] = '\0'; + return nftnl_table_snprintf(buf, size, t, type, flags); } |