tree 2257dd4c04f4d234caf770a748b290b4d144fcf5
parent f0b9d796002d9d39575cf1beabfb625f68b507fa
author Stephen Smalley <[EMAIL PROTECTED]> Fri, 29 Jul 2005 11:16:21 -0700
committer Linus Torvalds <[EMAIL PROTECTED]> Fri, 29 Jul 2005 11:46:05 -0700

[PATCH] selinux: Fix address length checks in connect hook

This patch fixes the address length checks in the selinux_socket_connect
hook to be no more restrictive than the underlying ipv4 and ipv6 code;
otherwise, this hook can reject valid connect calls.  This patch is in
response to a bug report where an application was calling connect on an
INET6 socket with an address that didn't include the optional scope id and
failing due to these checks.

Signed-off-by: Stephen Smalley <[EMAIL PROTECTED]>
Signed-off-by: James Morris <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

 security/selinux/hooks.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -3126,12 +3126,12 @@ static int selinux_socket_connect(struct
 
                if (sk->sk_family == PF_INET) {
                        addr4 = (struct sockaddr_in *)address;
-                       if (addrlen != sizeof(struct sockaddr_in))
+                       if (addrlen < sizeof(struct sockaddr_in))
                                return -EINVAL;
                        snum = ntohs(addr4->sin_port);
                } else {
                        addr6 = (struct sockaddr_in6 *)address;
-                       if (addrlen != sizeof(struct sockaddr_in6))
+                       if (addrlen < SIN6_LEN_RFC2133)
                                return -EINVAL;
                        snum = ntohs(addr6->sin6_port);
                }
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to