Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/x86 Check buffer length correctly to not to pri...



details:   https://anonhg.NetBSD.org/src/rev/eef359c705de
branches:  trunk
changeset: 826334:eef359c705de
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Mon Aug 28 07:03:47 2017 +0000

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

diffstat:

 sys/arch/x86/x86/procfs_machdep.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r f0d23679e875 -r eef359c705de sys/arch/x86/x86/procfs_machdep.c
--- a/sys/arch/x86/x86/procfs_machdep.c Mon Aug 28 06:59:25 2017 +0000
+++ b/sys/arch/x86/x86/procfs_machdep.c Mon Aug 28 07:03:47 2017 +0000
@@ -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 @@
        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;



Home | Main Index | Thread Index | Old Index