diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2014-10-21 11:28:12 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-11-21 09:23:05 -0800 |
commit | c74c508e0ee513fbaf7516e8db89e9050a2c0e1e (patch) | |
tree | 9f57814d8b1c4d9a5f00f004eb8ae042b9df0023 /net | |
parent | fdf538ce50f08e3b19ed297705a01c59e593c457 (diff) | |
download | lwn-c74c508e0ee513fbaf7516e8db89e9050a2c0e1e.tar.gz lwn-c74c508e0ee513fbaf7516e8db89e9050a2c0e1e.zip |
netfilter: ipset: off by one in ip_set_nfnl_get_byindex()
commit 0f9f5e1b83abd2b37c67658e02a6fc9001831fa5 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/ipset/ip_set_core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c index de770ec39e51..cf9937743abb 100644 --- a/net/netfilter/ipset/ip_set_core.c +++ b/net/netfilter/ipset/ip_set_core.c @@ -636,7 +636,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); |