Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/ibcs2 Zero buffers in ibcs2 ioctl to avoid disclo...



details:   https://anonhg.NetBSD.org/src/rev/5f1dc574a3a3
branches:  trunk
changeset: 825720:5f1dc574a3a3
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Jul 28 17:57:48 2017 +0000

description:
Zero buffers in ibcs2 ioctl to avoid disclosing stack to userland.

>From Ilja Van Sprundel.

diffstat:

 sys/compat/ibcs2/ibcs2_ioctl.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r 9e844cc3e2b0 -r 5f1dc574a3a3 sys/compat/ibcs2/ibcs2_ioctl.c
--- a/sys/compat/ibcs2/ibcs2_ioctl.c    Fri Jul 28 17:52:47 2017 +0000
+++ b/sys/compat/ibcs2/ibcs2_ioctl.c    Fri Jul 28 17:57:48 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ibcs2_ioctl.c,v 1.45 2008/06/24 10:03:17 gmcgarry Exp $        */
+/*     $NetBSD: ibcs2_ioctl.c,v 1.46 2017/07/28 17:57:48 riastradh Exp $       */
 
 /*
  * Copyright (c) 1994, 1995 Scott Bartram
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ibcs2_ioctl.c,v 1.45 2008/06/24 10:03:17 gmcgarry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibcs2_ioctl.c,v 1.46 2017/07/28 17:57:48 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -402,8 +402,10 @@
                if ((error = (*ctl)(fp, TIOCGETA, &bts)) != 0)
                        goto out;
 
+               memset(&sts, 0, sizeof(sts));
                btios2stios(&bts, &sts);
                if (SCARG(uap, cmd) == IBCS2_TCGETA) {
+                       memset(&st, 0, sizeof(st));
                        stios2stio(&sts, &st);
                        error = copyout(&st, SCARG(uap, data), sizeof(st));
                        if (error)
@@ -559,6 +561,7 @@
 
        fd_putfile(SCARG(uap, fd));
 
+       memset(&itb, 0, sizeof(itb));
        itb.sg_ispeed = tb.sg_ispeed;
        itb.sg_ospeed = tb.sg_ospeed;
        itb.sg_erase = tb.sg_erase;



Home | Main Index | Thread Index | Old Index