Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/acpitools/acpidump Fix acpi_print_string(). Treat N...



details:   https://anonhg.NetBSD.org/src/rev/d2def7888d4a
branches:  trunk
changeset: 447072:d2def7888d4a
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Sun Dec 30 05:05:21 2018 +0000

description:
Fix acpi_print_string(). Treat NUL termination correctly to not to print
NUL character. For example, this change prints an OEMID "41 4d 44 00 41 4d"
with "AMD". Tested by Patrick Welche.

diffstat:

 usr.sbin/acpitools/acpidump/acpi.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r df932242a662 -r d2def7888d4a usr.sbin/acpitools/acpidump/acpi.c
--- a/usr.sbin/acpitools/acpidump/acpi.c        Sun Dec 30 04:18:09 2018 +0000
+++ b/usr.sbin/acpitools/acpidump/acpi.c        Sun Dec 30 05:05:21 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi.c,v 1.42 2018/12/02 10:51:07 msaitoh Exp $ */
+/* $NetBSD: acpi.c,v 1.43 2018/12/30 05:05:21 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 1998 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: acpi.c,v 1.42 2018/12/02 10:51:07 msaitoh Exp $");
+__RCSID("$NetBSD: acpi.c,v 1.43 2018/12/30 05:05:21 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/endian.h>
@@ -215,6 +215,8 @@
 
        while (length--) {
                c = *s++;
+               if (c == '\0')
+                       return;
                putchar(c);
        }
 }



Home | Main Index | Thread Index | Old Index