diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2017-04-07 12:49:37 +1000 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2017-04-07 12:49:37 +1000 |
commit | c09c2a4d3f5804bcfb964ea9ee7f5056905a93e1 (patch) | |
tree | 8af7dd253d1a38cfc29a0bd29719a58f8c30af4b /security/selinux/hooks.c | |
parent | be5e03fda51b584252d765bd08eb7a0e1d86626a (diff) | |
parent | cae303df3f379f04ce7efadb2e30de460918b302 (diff) | |
download | linux-next-c09c2a4d3f5804bcfb964ea9ee7f5056905a93e1.tar.gz |
Merge remote-tracking branch 'selinux/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; |