Skip to contentSkip to conversation

netfilter: nft_meta: fix lack of validation of the input register

PATCH New Pablo Neira Ayuso 1 participant 1 message Jan 9, 2014

Subsystems (2)
lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 netfilter: nft_meta: fix lack of validation of the input register

We have to validate that the input register is in the range of allowed registers, otherwise we can take a incorrect register value as input that may lead us to a crash.

---
 net/netfilter/nft_meta.c |    3 +++
 1 file changed, 3 insertions(+)
net/netfilter/nft_meta.c +3 -0
index b43975a..e8254ad 100644
@@ -239,6 +239,9 @@ static int nft_meta_init(const struct nft_ctx *ctx, const struct nft_expr *expr,
 		return err;
 
 	priv->sreg = ntohl(nla_get_be32(tb[NFTA_META_SREG]));
+	err = nft_validate_input_register(priv->sreg);
+	if (err < 0)
+		return err;
 
 	return 0;
 }
Signature · 1 line
1.7.10.4