summaryrefslogtreecommitdiffstats
path: root/src/expr/log.c
diff options
context:
space:
mode:
authorAna Rey <anarey@gmail.com>2013-11-19 17:56:18 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2013-11-19 21:04:59 +0100
commit2b690deea3a9e43f9f73372b3d712f55365c2379 (patch)
treed53d90393bbf675e5811742427f10b74e7882bf5 /src/expr/log.c
parent0bec6bc5e58a8fac7ed6aa637a906a7d7378cf4e (diff)
expr: log: fix missing \0 when sending log prefix to kernel
If I run my automatic unit test for libnftables, It shows: "ERROR: Expr NFT_EXPR_LOG_PREFIX mismatches" a: test b: test ^^ garbage The problem was in nft_rule_expr_log_build function. With the attached patch, we use mnl_attr_put_strz() instead of mnl_attr_put_str() as in other functions in the library. Signed-off-by: Ana Rey <anarey@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/expr/log.c')
-rw-r--r--src/expr/log.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/expr/log.c b/src/expr/log.c
index 2d3e0cf..62db2a7 100644
--- a/src/expr/log.c
+++ b/src/expr/log.c
@@ -119,7 +119,7 @@ nft_rule_expr_log_build(struct nlmsghdr *nlh, struct nft_rule_expr *e)
struct nft_expr_log *log = nft_expr_data(e);
if (e->flags & (1 << NFT_EXPR_LOG_PREFIX))
- mnl_attr_put_str(nlh, NFTA_LOG_PREFIX, log->prefix);
+ mnl_attr_put_strz(nlh, NFTA_LOG_PREFIX, log->prefix);
if (e->flags & (1 << NFT_EXPR_LOG_GROUP))
mnl_attr_put_u16(nlh, NFTA_LOG_GROUP, htons(log->group));
if (e->flags & (1 << NFT_EXPR_LOG_SNAPLEN))