Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Clamp the length we use, not the length we don't.



details:   https://anonhg.NetBSD.org/src/rev/54568dc22e40
branches:  trunk
changeset: 825700:54568dc22e40
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Jul 28 15:16:39 2017 +0000

description:
Clamp the length we use, not the length we don't.

Avoids uninitialized memory disclosure to userland.

>From Ilja Van Sprundel.

diffstat:

 sys/kern/kern_ktrace.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 95ff638e420a -r 54568dc22e40 sys/kern/kern_ktrace.c
--- a/sys/kern/kern_ktrace.c    Fri Jul 28 15:02:52 2017 +0000
+++ b/sys/kern/kern_ktrace.c    Fri Jul 28 15:16:39 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_ktrace.c,v 1.170 2017/06/01 02:45:13 chs Exp $    */
+/*     $NetBSD: kern_ktrace.c,v 1.171 2017/07/28 15:16:39 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_ktrace.c,v 1.170 2017/06/01 02:45:13 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ktrace.c,v 1.171 2017/07/28 15:16:39 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -926,7 +926,7 @@
 
        user_dta = (void *)(ktp + 1);
        if ((error = copyin(addr, user_dta, len)) != 0)
-               len = 0;
+               kte->kte_kth.ktr_len = 0;
 
        ktraddentry(l, kte, KTA_WAITOK);
        return error;



Home | Main Index | Thread Index | Old Index