Module Name:    src
Committed By:   msaitoh
Date:           Mon Aug 28 07:03:47 UTC 2017

Modified Files:
        src/sys/arch/x86/x86: procfs_machdep.c

Log Message:
 Check buffer length correctly to not to print a garbage character.
Fixes PR#52352 reported by Yasushi Oshima.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x86/x86/procfs_machdep.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/arch/x86/x86/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.15 src/sys/arch/x86/x86/procfs_machdep.c:1.16
--- src/sys/arch/x86/x86/procfs_machdep.c:1.15	Mon May 15 04:21:14 2017
+++ src/sys/arch/x86/x86/procfs_machdep.c	Mon Aug 28 07:03:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.15 2017/05/15 04:21:14 msaitoh Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.16 2017/08/28 07:03:47 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.15 2017/05/15 04:21:14 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.16 2017/08/28 07:03:47 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -203,7 +203,7 @@ procfs_getcpuinfstr(char *bf, size_t *le
 	for (CPU_INFO_FOREACH(cii, ci)) {
 		procfs_getonecpu(i++, ci, bf, &used);
 		total += used + 1;
-		if (used + 1 < size) {
+		if (used + 1 <= size) {
 			bf += used;
 			*bf++ = '\n';
 			size -= used + 1;

Reply via email to