Skip to contentSkip to conversation

src: expr: target: fixed error in nft_rule_expr_target_parse

PATCH In review Ana Rey 2 participants 2 messages Nov 19, 2013 netfilter

lore
Share & tools
lore

Ana Rey

author
#0 lore raw

PATCH 1/1 src: expr: target: fixed error in nft_rule_expr_target_parse

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".

---
 src/expr/target.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/expr/target.c +1 -1
index 20bf2af..23dff3a 100644
@@ -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)
Signature · 1 line
1.8.4.rc3
#1 lore raw
Quoted 8 lines · Ana Rey

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".

Good catches, thanks for these fixes Ana.