Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Don't call strncmp() where the length arg is the si...
details: https://anonhg.NetBSD.org/src/rev/2d71a5de201a
branches: trunk
changeset: 960982:2d71a5de201a
user: simonb <simonb%NetBSD.org@localhost>
date: Mon Apr 05 05:47:31 2021 +0000
description:
Don't call strncmp() where the length arg is the size of a pointer
instead of the max string length. Switch to strcmp() - both strings
are known nul-terminated.
Thanks tnn@ (and clang!).
diffstat:
sys/kern/subr_hash.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diffs (28 lines):
diff -r 695bcedd09e0 -r 2d71a5de201a sys/kern/subr_hash.c
--- a/sys/kern/subr_hash.c Mon Apr 05 02:17:52 2021 +0000
+++ b/sys/kern/subr_hash.c Mon Apr 05 05:47:31 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_hash.c,v 1.8 2021/04/01 06:22:09 simonb Exp $ */
+/* $NetBSD: subr_hash.c,v 1.9 2021/04/05 05:47:31 simonb Exp $ */
/*
* Copyright (c) 1982, 1986, 1991, 1993
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_hash.c,v 1.8 2021/04/01 06:22:09 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_hash.c,v 1.9 2021/04/05 05:47:31 simonb Exp $");
#include <sys/param.h>
#include <sys/bitops.h>
@@ -222,8 +222,7 @@
sysctl_unlock();
rw_enter(&hashstat_lock, RW_READER);
TAILQ_FOREACH(hash, &hashstat_list, hs_next) {
- if (query &&
- (strncmp(hash->hs_name, queryname, sizeof(hash->hs_name)) != 0)) {
+ if (query && (strcmp(hash->hs_name, queryname) != 0)) {
continue;
}
Home |
Main Index |
Thread Index |
Old Index