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/658da4d2555f
branches:  trunk
changeset: 995628:658da4d2555f
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 b6f7d3d19855 -r 658da4d2555f 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