summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2001-01-23 02:18:56 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2001-01-23 02:18:56 +0000
commit54e32e8f038292fdc6fb22fd5e37d89871a919a0 (patch)
treeeab17c7944dfd717a2a9cc1e925921145eb454b4 /sys
parent6baa8dc4583e81d491bee16c0c94f3b28d05bbf0 (diff)
when the peer is disconnected before accept(2) is issued,
do not return junk data in mbuf (= sockaddr on accept(2)'s 2nd arg). set the length to zero. behavior checked with bsdi and freebsd. partial solution to NetBSD PR 12027 and 10698 (need more investigation).
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/uipc_socket.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 82d9575ed05..d2e71f2c956 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.28 2000/11/16 20:02:19 provos Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.29 2001/01/23 02:18:55 itojun Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -271,6 +271,8 @@ soaccept(so, nam)
if ((so->so_state & SS_ISDISCONNECTED) == 0)
error = (*so->so_proto->pr_usrreq)(so, PRU_ACCEPT, NULL,
nam, NULL);
+ else
+ nam->m_len = 0;
splx(s);
return (error);
}