diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-10-04 13:58:53 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-10-04 14:17:24 +0200 |
commit | 2c8e01c555a488f32c9648a1b8ee7b6ed1c3e194 (patch) | |
tree | 2c51cfaf055ed34a3166082f664b7e29c33b57ad /src/common.c | |
parent | 750fbea1a1b58d383707ce121e1140dbc5a8ee58 (diff) |
src: no need to nul-terminate buffer for nftnl_fprintf() calls
This function bails out with -1 if we cannot print, and this buffer is
internally allocated. No need for this overly deffensive initialization.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/common.c')
-rw-r--r-- | src/common.c | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/src/common.c b/src/common.c index ba5a49f..a95883c 100644 --- a/src/common.c +++ b/src/common.c @@ -94,9 +94,6 @@ EXPORT_SYMBOL(nftnl_parse_perror); int nftnl_cmd_header_snprintf(char *buf, size_t size, uint32_t cmd, uint32_t type, uint32_t flags) { - if (size) - buf[0] = '\0'; - NFTNL_BUF_INIT(b, buf, size); if (cmd == NFTNL_CMD_UNSPEC) @@ -138,9 +135,6 @@ int nftnl_cmd_header_fprintf(FILE *fp, uint32_t cmd, uint32_t type, int nftnl_cmd_footer_snprintf(char *buf, size_t size, uint32_t cmd, uint32_t type, uint32_t flags) { - if (size) - buf[0] = '\0'; - NFTNL_BUF_INIT(b, buf, size); if (cmd == NFTNL_CMD_UNSPEC) |