Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Fix info leaks: the alignment of the structures cau...
details: https://anonhg.NetBSD.org/src/rev/72a940e7e565
branches: trunk
changeset: 461838:72a940e7e565
user: maxv <maxv%NetBSD.org@localhost>
date: Thu Jul 11 17:30:44 2019 +0000
description:
Fix info leaks: the alignment of the structures causes uninitialized heap
memory to be copied to userland in sys_recvmsg().
diffstat:
sys/kern/uipc_socket2.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diffs (29 lines):
diff -r 7012f02854bb -r 72a940e7e565 sys/kern/uipc_socket2.c
--- a/sys/kern/uipc_socket2.c Thu Jul 11 17:07:10 2019 +0000
+++ b/sys/kern/uipc_socket2.c Thu Jul 11 17:30:44 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_socket2.c,v 1.133 2018/11/04 16:30:29 christos Exp $ */
+/* $NetBSD: uipc_socket2.c,v 1.134 2019/07/11 17:30:44 maxv Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket2.c,v 1.133 2018/11/04 16:30:29 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket2.c,v 1.134 2019/07/11 17:30:44 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_ddb.h"
@@ -1421,6 +1421,10 @@
cp->cmsg_len = CMSG_LEN(size);
cp->cmsg_level = level;
cp->cmsg_type = type;
+
+ memset(cp + 1, 0, CMSG_LEN(0) - sizeof(*cp));
+ memset((uint8_t *)*p + size, 0, CMSG_ALIGN(size) - size);
+
return m;
}
Home |
Main Index |
Thread Index |
Old Index