If I run my automatic unit test for libnftables, It shows:
"ERROR: Expr NFT_EXPR_LOG_PREFIX mismatches"
a: test
b: test\ 6
^^
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>
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))