Merge branch 'mount.part1' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[sfrench/cifs-2.6.git] / security / selinux / hooks.c
index 5bc230327bc0cb514be79ee872f55baf2e8f2c8f..f0e36c3492baee41642fbd232625c94720ac31a4 100644 (file)
@@ -5104,6 +5104,9 @@ static int selinux_sctp_bind_connect(struct sock *sk, int optname,
        addr_buf = address;
 
        while (walk_size < addrlen) {
+               if (walk_size + sizeof(sa_family_t) > addrlen)
+                       return -EINVAL;
+
                addr = addr_buf;
                switch (addr->sa_family) {
                case AF_UNSPEC: