Module Name:    src
Committed By:   christos
Date:           Mon Apr 15 20:51:46 UTC 2019

Modified Files:
        src/sys/net: if.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.448 -r1.449 src/sys/net/if.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.448 src/sys/net/if.c:1.449
--- src/sys/net/if.c:1.448	Wed Apr 10 23:07:11 2019
+++ src/sys/net/if.c	Mon Apr 15 16:51:46 2019
@@ -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 @@ ifconf(u_long cmd, void *data)
 	int bound;
 	struct psref psref;
 
+	memset(&ifr, 0, sizeof(ifr));
 	if (docopy) {
 		space = ifc->ifc_len;
 		ifrp = ifc->ifc_req;

Reply via email to