Module Name: src Committed By: christos Date: Sun Jun 13 03:09:20 UTC 2021
Modified Files: src/sys/kern: subr_hash.c Log Message: need to copyin when reading the hash name from userland To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/kern/subr_hash.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/kern/subr_hash.c diff -u src/sys/kern/subr_hash.c:1.9 src/sys/kern/subr_hash.c:1.10 --- src/sys/kern/subr_hash.c:1.9 Mon Apr 5 01:47:31 2021 +++ src/sys/kern/subr_hash.c Sat Jun 12 23:09:20 2021 @@ -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 @@ hashstat_sysctl(SYSCTLFN_ARGS) 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 @@ hashstat_sysctl(SYSCTLFN_ARGS) } 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; }