]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[IPV6]: Handle np->opt being NULL in ipv6_getsockopt_sticky(). (CVE-2007-1000)
authorDavid S. Miller <davem@davemloft.net>
Fri, 9 Mar 2007 06:15:40 +0000 (07:15 +0100)
committerAdrian Bunk <bunk@stusta.de>
Fri, 9 Mar 2007 06:15:40 +0000 (07:15 +0100)
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
net/ipv6/ipv6_sockglue.c

index f7142ba519abc5a195eb532a1643e0f9e5461056..03ecbfeab84954108dce74294992eb2a14ed1b65 100644 (file)
@@ -631,11 +631,15 @@ e_inval:
        return -EINVAL;
 }
 
-static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_opt_hdr *hdr,
+static int ipv6_getsockopt_sticky(struct sock *sk, struct ipv6_txoptions *opt,
                                  char __user *optval, int len)
 {
-       if (!hdr)
+       struct ipv6_opt_hdr *hdr;
+
+       if (!opt || !opt->hopopt)
                return 0;
+       hdr = opt->hopopt;
+
        len = min_t(int, len, ipv6_optlen(hdr));
        if (copy_to_user(optval, hdr, ipv6_optlen(hdr)))
                return -EFAULT;
@@ -779,7 +783,7 @@ int ipv6_getsockopt(struct sock *sk, int level, int optname,
        {
 
                lock_sock(sk);
-               len = ipv6_getsockopt_sticky(sk, np->opt->hopopt,
+               len = ipv6_getsockopt_sticky(sk, np->opt,
                                             optval, len);
                release_sock(sk);
                return put_user(len, optlen);