diff options
author | Paul Irofti <pirofti@cvs.openbsd.org> | 2011-09-19 22:37:04 +0000 |
---|---|---|
committer | Paul Irofti <pirofti@cvs.openbsd.org> | 2011-09-19 22:37:04 +0000 |
commit | c3281227212e43e1a56538f6f380da423f718ad8 (patch) | |
tree | f29dba8fcfffac44facf156d75fb3f798c4944a1 | |
parent | 5c2747528ce7ea3cd954f2c203665563b5a07cd1 (diff) |
Fix Unix socket handling when the length is too large by trimming.
Okay claudio@
-rw-r--r-- | sys/compat/linux/linux_socket.c | 8 |
1 files changed, 6 insertions, 2 deletions
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 <sys/protosw.h> #include <sys/socket.h> #include <sys/socketvar.h> +#include <sys/un.h> #include <net/if.h> #include <net/if_types.h> #include <net/if_dl.h> @@ -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; /* |