aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/uipc_syscalls.c
diff options
context:
space:
mode:
authorMike Smith <msmith@FreeBSD.org>1997-12-14 03:15:21 +0000
committerMike Smith <msmith@FreeBSD.org>1997-12-14 03:15:21 +0000
commit5af7db2b732399b5359fc74c7c6f8e9ba652d55c (patch)
treeb17cbaa6cf311dfd19067264ef23a576d5ba9177 /sys/kern/uipc_syscalls.c
parent8256655132964fa9a66e59362d57306b96e94d68 (diff)
downloadsrc-5af7db2b732399b5359fc74c7c6f8e9ba652d55c.tar.gz
src-5af7db2b732399b5359fc74c7c6f8e9ba652d55c.zip
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)
Notes
Notes: svn path=/head/; revision=31710
Diffstat (limited to 'sys/kern/uipc_syscalls.c')
-rw-r--r--sys/kern/uipc_syscalls.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index 0c0e61fdaa28..15a69ce4ccbc 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)