diff options
author | James Morris <james.l.morris@oracle.com> | 2017-04-19 01:30:08 +0300 |
---|---|---|
committer | James Morris <james.l.morris@oracle.com> | 2017-04-19 01:30:08 +0300 |
commit | fa5b5b26e25cbab819e0955f948e8a6d5363f06f (patch) | |
tree | 1dfb743d934832546a5b3e7cfd02d83c1736c051 /security/selinux/hooks.c | |
parent | 30a83251dd8b7e3566be9ea8c4921bafc21bee8f (diff) | |
parent | cae303df3f379f04ce7efadb2e30de460918b302 (diff) | |
download | linux-fa5b5b26e25cbab819e0955f948e8a6d5363f06f.tar.xz |
Merge branch 'stable-4.12' of git://git.infradead.org/users/pcmoore/selinux into next
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r-- | security/selinux/hooks.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index d37a72316e9d..e67a526d1f30 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -4367,10 +4367,18 @@ static int selinux_socket_bind(struct socket *sock, struct sockaddr *address, in u32 sid, node_perm; if (family == PF_INET) { + if (addrlen < sizeof(struct sockaddr_in)) { + err = -EINVAL; + goto out; + } addr4 = (struct sockaddr_in *)address; snum = ntohs(addr4->sin_port); addrp = (char *)&addr4->sin_addr.s_addr; } else { + if (addrlen < SIN6_LEN_RFC2133) { + err = -EINVAL; + goto out; + } addr6 = (struct sockaddr_in6 *)address; snum = ntohs(addr6->sin6_port); addrp = (char *)&addr6->sin6_addr.s6_addr; |