Source-Changes-HG archive

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

[src/trunk]: src/sys/kern sendto(2), recvfrom(2): Scrub internal struct msghd...



details:   https://anonhg.NetBSD.org/src/rev/082e65bac44c
branches:  trunk
changeset: 368257:082e65bac44c
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Jul 01 22:30:51 2022 +0000

description:
sendto(2), recvfrom(2): Scrub internal struct msghdr on stack.

Otherwise this is kernel stack disclosure via ktrace.

Reported-by: syzbot+1d40303b310063778194%syzkaller.appspotmail.com@localhost

diffstat:

 sys/kern/uipc_syscalls.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 489add2ee39b -r 082e65bac44c sys/kern/uipc_syscalls.c
--- a/sys/kern/uipc_syscalls.c  Fri Jul 01 21:48:05 2022 +0000
+++ b/sys/kern/uipc_syscalls.c  Fri Jul 01 22:30:51 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_syscalls.c,v 1.205 2022/06/29 22:27:12 riastradh Exp $    */
+/*     $NetBSD: uipc_syscalls.c,v 1.206 2022/07/01 22:30:51 riastradh Exp $    */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.205 2022/06/29 22:27:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.206 2022/07/01 22:30:51 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pipe.h"
@@ -498,7 +498,7 @@
                syscallarg(const struct sockaddr *)     to;
                syscallarg(unsigned int)                tolen;
        } */
-       struct msghdr   msg;
+       struct msghdr   msg = {0};
        struct iovec    aiov;
 
        msg.msg_name = __UNCONST(SCARG(uap, to)); /* XXXUNCONST kills const */
@@ -694,7 +694,7 @@
                syscallarg(struct sockaddr *)   from;
                syscallarg(unsigned int *)      fromlenaddr;
        } */
-       struct msghdr   msg;
+       struct msghdr   msg = {0};
        struct iovec    aiov;
        int             error;
        struct mbuf     *from;



Home | Main Index | Thread Index | Old Index