]> granicus.if.org Git - ipset/commitdiff
netfilter: ipset: off by one in ip_set_nfnl_get_byindex()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 21 Oct 2014 16:18:14 +0000 (18:18 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Tue, 21 Oct 2014 16:18:14 +0000 (18:18 +0200)
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: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
kernel/net/netfilter/ipset/ip_set_core.c

index e14255fc53d163a222b487d87ebd3587b9e215d4..b3aead3f3528f7f0d0ba6e44cb9423dfde7680ea 100644 (file)
@@ -668,7 +668,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;
 
        lock_nfnl();