ipmr: off by one in __ipmr_fill_mroute()
authorDan Carpenter <error27@gmail.com>
Wed, 26 May 2010 07:38:56 +0000 (00:38 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 26 May 2010 07:38:56 +0000 (00:38 -0700)
This fixes a smatch warning:
net/ipv4/ipmr.c +1917 __ipmr_fill_mroute(12) error: buffer overflow
'(mrt)->vif_table' 32 <= 32

The ipv6 version had the same issue.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ipmr.c
net/ipv6/ip6mr.c

index 45889103b3e2a6e2dc76e5731f8ef2a7e9c821e0..856123fe32f98c97e3364a322fe9899d4b8d1359 100644 (file)
@@ -1911,7 +1911,7 @@ static int __ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb,
        struct rtattr *mp_head;
 
        /* If cache is unresolved, don't try to parse IIF and OIF */
-       if (c->mfc_parent > MAXVIFS)
+       if (c->mfc_parent >= MAXVIFS)
                return -ENOENT;
 
        if (VIF_EXISTS(mrt, c->mfc_parent))
index bd9e7d3e9c8e2fe4779dc42e63273972e5e76cfc..073071f2b75b500207a9c14f823d1d50f56b2aec 100644 (file)
@@ -2017,7 +2017,7 @@ static int __ip6mr_fill_mroute(struct mr6_table *mrt, struct sk_buff *skb,
        struct rtattr *mp_head;
 
        /* If cache is unresolved, don't try to parse IIF and OIF */
-       if (c->mf6c_parent > MAXMIFS)
+       if (c->mf6c_parent >= MAXMIFS)
                return -ENOENT;
 
        if (MIF_EXISTS(mrt, c->mf6c_parent))