diff options
author | msmith <msmith@FreeBSD.org> | 1997-12-14 03:15:21 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 1997-12-14 03:15:21 +0000 |
commit | c10e8d5102f64d08712d922be46b510dca101fe7 (patch) | |
tree | d56a6f6ddcfe5fd80eb3530c49c05dba2f479f18 | |
parent | 738872cad6b501578d2839e485ca5a73de1bcee5 (diff) | |
download | FreeBSD-src-c10e8d5102f64d08712d922be46b510dca101fe7.zip FreeBSD-src-c10e8d5102f64d08712d922be46b510dca101fe7.tar.gz |
As described by the submitter:
... fix a bug with orecvfrom() or recvfrom() called with
the MSG_COMPAT flag on kernels compiled with the COMPAT_43 option.
The symptom is that the fromaddr is not correctly returned.
This affects the Linux emulator.
Submitted by: pb@fasterix.freenix.org (Pierre Beyssac)
-rw-r--r-- | sys/kern/uipc_syscalls.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 0c0e61f..15a69ce 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.31 1997/10/12 20:24:17 phk Exp $ + * $Id: uipc_syscalls.c,v 1.32 1997/11/06 19:29:26 phk Exp $ */ #include "opt_ktrace.h" @@ -700,15 +700,16 @@ recvit(p, s, mp, namelenp) if (len <= 0 || fromsa == 0) len = 0; else { +#ifndef MIN +#define MIN(a,b) ((a)>(b)?(b):(a)) +#endif + /* save sa_len before it is destroyed by MSG_COMPAT */ + len = MIN(len, fromsa->sa_len); #ifdef COMPAT_OLDSOCK if (mp->msg_flags & MSG_COMPAT) ((struct osockaddr *)fromsa)->sa_family = fromsa->sa_family; #endif -#ifndef MIN -#define MIN(a,b) ((a)>(b)?(b):(a)) -#endif - len = MIN(len, fromsa->sa_len); error = copyout(fromsa, (caddr_t)mp->msg_name, (unsigned)len); if (error) |