Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi in acpi_debug_init(), the string we extract fro...



details:   https://anonhg.NetBSD.org/src/rev/2a859bec7476
branches:  trunk
changeset: 746152:2a859bec7476
user:      chs <chs%NetBSD.org@localhost>
date:      Mon Mar 23 00:37:19 2020 +0000

description:
in acpi_debug_init(), the string we extract from the dictionary is
a normal C string, so use strlcpy() rather than memcpy() to copy it.
found by KASAN.

diffstat:

 sys/dev/acpi/acpi_debug.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r f1ad9b5b3913 -r 2a859bec7476 sys/dev/acpi/acpi_debug.c
--- a/sys/dev/acpi/acpi_debug.c Sun Mar 22 23:38:47 2020 +0000
+++ b/sys/dev/acpi/acpi_debug.c Mon Mar 23 00:37:19 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_debug.c,v 1.6 2019/01/05 20:40:26 christos Exp $ */
+/* $NetBSD: acpi_debug.c,v 1.7 2020/03/23 00:37:19 chs Exp $ */
 
 /*-
  * Copyright (c) 2010 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_debug.c,v 1.6 2019/01/05 20:40:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_debug.c,v 1.7 2020/03/23 00:37:19 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/sysctl.h>
@@ -124,8 +124,8 @@
        layer = acpi_debug_getkey(acpi_debug_layer_d, AcpiDbgLayer);
        level = acpi_debug_getkey(acpi_debug_level_d, AcpiDbgLevel);
 
-       (void)memcpy(acpi_debug_layer_s, layer, ACPI_DEBUG_MAX);
-       (void)memcpy(acpi_debug_level_s, level, ACPI_DEBUG_MAX);
+       strlcpy(acpi_debug_layer_s, layer, ACPI_DEBUG_MAX);
+       strlcpy(acpi_debug_level_s, level, ACPI_DEBUG_MAX);
 
        return;
 



Home | Main Index | Thread Index | Old Index