]> git.ipfire.org Git - thirdparty/libnftnl.git/commitdiff
expr: target: fix wrong info length in nft_rule_expr_target_parse
authorAna Rey <anarey@gmail.com>
Tue, 19 Nov 2013 17:54:14 +0000 (18:54 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 19 Nov 2013 20:06:47 +0000 (21:06 +0100)
If I run my automatic unit test of libnftable, It shows:

ERROR: Expr NFT_EXPR_TG_INFO size mismatches size a: 32 b: 36

The problem was in nft_rule_expr_target_parse function. With the
attached patch, we use mnl_attr_get_payload_len() in instead of
mnl_attr_get_len().

Signed-off-by: Ana Rey <anarey@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/expr/target.c

index 20bf2af09656d8f31599e00ca396fb0ed7fe49f7..23dff3af07d26493dbf0b4cfd3775d6129847929 100644 (file)
@@ -149,7 +149,7 @@ static int nft_rule_expr_target_parse(struct nft_rule_expr *e, struct nlattr *at
        }
 
        if (tb[NFTA_TARGET_INFO]) {
-               uint32_t len = mnl_attr_get_len(tb[NFTA_TARGET_INFO]);
+               uint32_t len = mnl_attr_get_payload_len(tb[NFTA_TARGET_INFO]);
                void *target_data;
 
                if (target->data)