Pull up following revision(s) (requested by spz in ticket #194):

sys/kern/kern_ktrace.c: revision 1.171
Clamp the length we use, not the length we don't.
Avoids uninitialized memory disclosure to userland.
From Ilja Van Sprundel.
This commit is contained in:
snj 2017-08-09 05:14:20 +00:00
parent 82e1392702
commit e1d2f41f9f
1 changed files with 3 additions and 3 deletions

View File

@ -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.170.2.1 2017/08/09 05:14:20 snj 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.170.2.1 2017/08/09 05:14:20 snj Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -926,7 +926,7 @@ ktruser(const char *id, void *addr, size_t len, int ustr)
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;