Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/sys/kern Pull up following revision(s) (requested by maxv...



details:   https://anonhg.NetBSD.org/src/rev/84183f8aabfe
branches:  netbsd-8
changeset: 453763:84183f8aabfe
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Aug 07 08:21:55 2019 +0000

description:
Pull up following revision(s) (requested by maxv in ticket #1330):

        sys/kern/uipc_socket2.c: revision 1.134

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 769535b6fce1 -r 84183f8aabfe sys/kern/uipc_socket2.c
--- a/sys/kern/uipc_socket2.c   Tue Aug 06 18:22:57 2019 +0000
+++ b/sys/kern/uipc_socket2.c   Wed Aug 07 08:21:55 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_socket2.c,v 1.124.8.3 2018/07/31 17:01:20 martin Exp $    */
+/*     $NetBSD: uipc_socket2.c,v 1.124.8.4 2019/08/07 08:21:55 martin 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.124.8.3 2018/07/31 17:01:20 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket2.c,v 1.124.8.4 2019/08/07 08:21:55 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1419,6 +1419,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