From 13ebf21f177ffafbae1daebcc6b3550207ddfbb1 Mon Sep 17 00:00:00 2001 From: pirofti Date: Mon, 19 Sep 2011 22:37:03 +0000 Subject: Fix Unix socket handling when the length is too large by trimming. Okay claudio@ --- sys/compat/linux/linux_socket.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sys/compat/linux/linux_socket.c') diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index 45676c61104..b711c934f6e 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: linux_socket.c,v 1.41 2011/07/09 00:47:18 henning Exp $ */ +/* $OpenBSD: linux_socket.c,v 1.42 2011/09/19 22:37:03 pirofti Exp $ */ /* $NetBSD: linux_socket.c,v 1.14 1996/04/05 00:01:50 christos Exp $ */ /* @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -1250,7 +1251,10 @@ linux_sa_get(p, sgp, sap, osa, osalen) return (EINVAL); } - alloclen = *osalen; + if (osa->sa_family == AF_UNIX && *osalen > sizeof(struct sockaddr_un)) + alloclen = sizeof(struct sockaddr_un); + else + alloclen = *osalen; #ifdef INET6 oldv6size = 0; /* -- cgit v1.2.3-59-g8ed1b