netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 2/8] netfilter: ipset: off by one in ip_set_nfnl_get_byindex()
Date: Mon, 27 Oct 2014 22:38:01 +0100	[thread overview]
Message-ID: <1414445887-5108-3-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1414445887-5108-1-git-send-email-pablo@netfilter.org>

From: Dan Carpenter <dan.carpenter@oracle.com>

The ->ip_set_list[] array is initialized in ip_set_net_init() and it
has ->ip_set_max elements so this check should be >= instead of >
otherwise we are off by one.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/ipset/ip_set_core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
index 912e5a0..86f9d76 100644
--- a/net/netfilter/ipset/ip_set_core.c
+++ b/net/netfilter/ipset/ip_set_core.c
@@ -659,7 +659,7 @@ ip_set_nfnl_get_byindex(struct net *net, ip_set_id_t index)
 	struct ip_set *set;
 	struct ip_set_net *inst = ip_set_pernet(net);
 
-	if (index > inst->ip_set_max)
+	if (index >= inst->ip_set_max)
 		return IPSET_INVALID_ID;
 
 	nfnl_lock(NFNL_SUBSYS_IPSET);
-- 
1.7.10.4

  parent reply	other threads:[~2014-10-27 21:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-27 21:37 [PATCH 0/8] Netfilter fixes for net Pablo Neira Ayuso
2014-10-27 21:38 ` [PATCH 1/8] netfilter: nf_conntrack: allow server to become a client in TW handling Pablo Neira Ayuso
2014-10-27 21:38 ` Pablo Neira Ayuso [this message]
2014-10-27 21:38 ` [PATCH 3/8] netfilter: nf_tables: check for NULL in nf_tables_newchain pcpu stats allocation Pablo Neira Ayuso
2014-10-27 21:38 ` [PATCH 4/8] bridge: Do not compile options in br_parse_ip_options Pablo Neira Ayuso
2014-10-27 21:38 ` [PATCH 5/8] netfilter: nf_log: account for size of NLMSG_DONE attribute Pablo Neira Ayuso
2014-10-27 21:38 ` [PATCH 6/8] netfilter: nfnetlink_log: fix maximum packet length logged to userspace Pablo Neira Ayuso
2014-10-27 21:38 ` [PATCH 7/8] netfilter: nf_log: release skbuff on nlmsg put failure Pablo Neira Ayuso
2014-10-27 21:38 ` [PATCH 8/8] netfilter: nft_compat: fix wrong target lookup in nft_target_select_ops() Pablo Neira Ayuso
2014-10-27 22:49 ` [PATCH 0/8] Netfilter fixes for net David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1414445887-5108-3-git-send-email-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).