Source-Changes-HG archive

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

[src/trunk]: src/sys/net Zero out the ifreq struct for SIOCGIFCONF to avoid u...



details:   https://anonhg.NetBSD.org/src/rev/4e2dccc1463e
branches:  trunk
changeset: 450479:4e2dccc1463e
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Apr 15 20:51:46 2019 +0000

description:
Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks!

diffstat:

 sys/net/if.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r c0f397fc474e -r 4e2dccc1463e sys/net/if.c
--- a/sys/net/if.c      Mon Apr 15 20:46:10 2019 +0000
+++ b/sys/net/if.c      Mon Apr 15 20:51:46 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.448 2019/04/11 03:07:11 msaitoh Exp $ */
+/*     $NetBSD: if.c,v 1.449 2019/04/15 20:51:46 christos Exp $        */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.448 2019/04/11 03:07:11 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.449 2019/04/15 20:51:46 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -3328,6 +3328,7 @@
        int bound;
        struct psref psref;
 
+       memset(&ifr, 0, sizeof(ifr));
        if (docopy) {
                space = ifc->ifc_len;
                ifrp = ifc->ifc_req;



Home | Main Index | Thread Index | Old Index