diff options
author | msmith <msmith@FreeBSD.org> | 1997-12-15 02:29:11 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 1997-12-15 02:29:11 +0000 |
commit | 22a447567942a92b80083492f9b44f26e8beb052 (patch) | |
tree | 8c66530ee16cc667067ea1de64f8b7ab3ddb52d4 /sys | |
parent | ba494eff3a511b2f5c5d9bbc02686772b9ed4de7 (diff) | |
download | FreeBSD-src-22a447567942a92b80083492f9b44f26e8beb052.zip FreeBSD-src-22a447567942a92b80083492f9b44f26e8beb052.tar.gz |
Consult sa_len before trampling it with MSG_COMPAT set.
PR: kern/5291
Submitted by: pb@fasterix.freenix.org (Pierre Beyssac)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/uipc_syscalls.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 15a69ce..35c483b 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)uipc_syscalls.c 8.4 (Berkeley) 2/21/94 - * $Id: uipc_syscalls.c,v 1.32 1997/11/06 19:29:26 phk Exp $ + * $Id: uipc_syscalls.c,v 1.33 1997/12/14 03:15:21 msmith Exp $ */ #include "opt_ktrace.h" @@ -243,13 +243,14 @@ accept1(p, uap, compat) return 0; } if (uap->name) { + /* check sa_len before it is destroyed */ + if (namelen > sa->sa_len) + namelen = sa->sa_len; #ifdef COMPAT_OLDSOCK if (compat) ((struct osockaddr *)sa)->sa_family = sa->sa_family; #endif - if (namelen > sa->sa_len) - namelen = sa->sa_len; error = copyout(sa, (caddr_t)uap->name, (u_int)namelen); if (!error) gotnoname: |