Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern need to copyin when reading the hash name from user...
details: https://anonhg.NetBSD.org/src/rev/c5e91f48de0c
branches: trunk
changeset: 1021666:c5e91f48de0c
user: christos <christos%NetBSD.org@localhost>
date: Sun Jun 13 03:09:20 2021 +0000
description:
need to copyin when reading the hash name from userland
diffstat:
sys/kern/subr_hash.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diffs (38 lines):
diff -r 801d698ac945 -r c5e91f48de0c sys/kern/subr_hash.c
--- a/sys/kern/subr_hash.c Sun Jun 13 03:07:57 2021 +0000
+++ b/sys/kern/subr_hash.c Sun Jun 13 03:09:20 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_hash.c,v 1.9 2021/04/05 05:47:31 simonb Exp $ */
+/* $NetBSD: subr_hash.c,v 1.10 2021/06/13 03:09:20 christos Exp $ */
/*
* Copyright (c) 1982, 1986, 1991, 1993
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_hash.c,v 1.9 2021/04/05 05:47:31 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_hash.c,v 1.10 2021/06/13 03:09:20 christos Exp $");
#include <sys/param.h>
#include <sys/bitops.h>
@@ -207,6 +207,7 @@
if (namelen > 0 && name[0] == CTL_QUERY) {
const struct hashstat_sysctl *h = newp;
+ size_t s;
if (h == NULL) {
/* Can't QUERY one hash without supplying the hash name. */
@@ -214,7 +215,10 @@
}
query = true;
h = newp;
- strlcpy(queryname, h->hash_name, sizeof(queryname));
+ error = sysctl_copyinstr(l, h->hash_name, queryname,
+ sizeof(queryname), &s);
+ if (error)
+ return error;
} else {
query = false;
}
Home |
Main Index |
Thread Index |
Old Index