Subject: kern/30565: off-by-one in sys/kern/kern_sysctl.c
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Peter Postma <peter@pointless.nl>
List: netbsd-bugs
Date: 06/20/2005 14:15:00
>Number: 30565
>Category: kern
>Synopsis: off-by-one in sys/kern/kern_sysctl.c
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jun 20 14:15:00 +0000 2005
>Originator: Peter Postma
>Release: NetBSD 3.99.6
>Organization:
>Environment:
System: NetBSD mercury.pointless.nl 3.99.6 NetBSD 3.99.6 (mercury) #7: Fri Jun 17 15:42:01 CEST 2005 peter@mercury.pointless.nl:/usr/obj/sys/arch/sparc64/compile/mercury sparc64
Architecture: sparc64
Machine: sparc64
>Description:
off-by-one in sys/kern/kern_sysctl.c
>How-To-Repeat:
RTFS.
>Fix:
Index: kern_sysctl.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_sysctl.c,v
retrieving revision 1.183
diff -u -r1.183 kern_sysctl.c
--- kern_sysctl.c 20 Jun 2005 02:49:18 -0000 1.183
+++ kern_sysctl.c 20 Jun 2005 14:09:00 -0000
@@ -1899,7 +1899,7 @@
/*
* what's it called
*/
- if (strlcpy(nnode.sysctl_name, namep, sizeof(nnode.sysctl_name)) >
+ if (strlcpy(nnode.sysctl_name, namep, sizeof(nnode.sysctl_name)) >=
sizeof(nnode.sysctl_name))
return (ENAMETOOLONG);