Skip to content

Commit

Permalink
netfilter: ipset: off by one in ip_set_nfnl_get_byindex()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Pablo Neira Ayuso committed Oct 22, 2014
1 parent e37ad9f commit 0f9f5e1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/netfilter/ipset/ip_set_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0f9f5e1

Please sign in to comment.