diff options
author | Patrick McHardy <kaber@trash.net> | 2015-04-11 02:27:30 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2015-04-13 16:25:50 +0200 |
commit | d07db9884a5fba8c8020166c86183c79a18d066a (patch) | |
tree | 74579f0a339d2fa8f8586b5971311ba3ba62ecff /net/netfilter/nft_byteorder.c | |
parent | 27e6d2017abdfbdb8b790c34c93d65ee10ce2fc5 (diff) | |
download | op-kernel-dev-d07db9884a5fba8c8020166c86183c79a18d066a.zip op-kernel-dev-d07db9884a5fba8c8020166c86183c79a18d066a.tar.gz |
netfilter: nf_tables: introduce nft_validate_register_load()
Change nft_validate_input_register() to not only validate the input
register number, but also the length of the load, and rename it to
nft_validate_register_load() to reflect that change.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter/nft_byteorder.c')
-rw-r--r-- | net/netfilter/nft_byteorder.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/net/netfilter/nft_byteorder.c b/net/netfilter/nft_byteorder.c index 848bce0..f34bfbd 100644 --- a/net/netfilter/nft_byteorder.c +++ b/net/netfilter/nft_byteorder.c @@ -96,10 +96,6 @@ static int nft_byteorder_init(const struct nft_ctx *ctx, return -EINVAL; } - priv->len = ntohl(nla_get_be32(tb[NFTA_BYTEORDER_LEN])); - if (priv->len == 0 || priv->len > FIELD_SIZEOF(struct nft_data, data)) - return -EINVAL; - priv->size = ntohl(nla_get_be32(tb[NFTA_BYTEORDER_SIZE])); switch (priv->size) { case 2: @@ -110,7 +106,8 @@ static int nft_byteorder_init(const struct nft_ctx *ctx, } priv->sreg = ntohl(nla_get_be32(tb[NFTA_BYTEORDER_SREG])); - err = nft_validate_input_register(priv->sreg); + priv->len = ntohl(nla_get_be32(tb[NFTA_BYTEORDER_LEN])); + err = nft_validate_register_load(priv->sreg, priv->len); if (err < 0) return err; |