summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2014-01-21 23:57:57 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2014-01-21 23:57:57 +0000
commitddc466704e474c7581d61ff7a5c5d32de823176d (patch)
tree08a4645c901869fb0c2d042b70e306c6c87300e6
parente7e8b72b43372984acc9d371b5c0d3d0f3b226f9 (diff)
Don't leak kernel stack in timeval padding in getsockopt(SO_{SND,RCV}TIMEO)
ok mikeb@ deraadt@
-rw-r--r--sys/kern/uipc_socket.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 1a6579c454b..9027ce24e4d 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.121 2014/01/11 14:33:48 bluhm Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.122 2014/01/21 23:57:56 guenther Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -1702,6 +1702,7 @@ sogetopt(struct socket *so, int level, int optname, struct mbuf **mp)
so->so_snd.sb_timeo : so->so_rcv.sb_timeo);
m->m_len = sizeof(struct timeval);
+ memset(&tv, 0, sizeof(tv));
tv.tv_sec = val / hz;
tv.tv_usec = (val % hz) * tick;
memcpy(mtod(m, struct timeval *), &tv, sizeof tv);