aboutsummaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
Diffstat (limited to 'security')
-rw-r--r--security/selinux/hooks.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 10fd51c9056d..2253f388234f 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -3126,12 +3126,12 @@ static int selinux_socket_connect(struct socket *sock, struct sockaddr *address,
3126 3126
3127 if (sk->sk_family == PF_INET) { 3127 if (sk->sk_family == PF_INET) {
3128 addr4 = (struct sockaddr_in *)address; 3128 addr4 = (struct sockaddr_in *)address;
3129 if (addrlen != sizeof(struct sockaddr_in)) 3129 if (addrlen < sizeof(struct sockaddr_in))
3130 return -EINVAL; 3130 return -EINVAL;
3131 snum = ntohs(addr4->sin_port); 3131 snum = ntohs(addr4->sin_port);
3132 } else { 3132 } else {
3133 addr6 = (struct sockaddr_in6 *)address; 3133 addr6 = (struct sockaddr_in6 *)address;
3134 if (addrlen != sizeof(struct sockaddr_in6)) 3134 if (addrlen < SIN6_LEN_RFC2133)
3135 return -EINVAL; 3135 return -EINVAL;
3136 snum = ntohs(addr6->sin6_port); 3136 snum = ntohs(addr6->sin6_port);
3137 } 3137 }