Module Name:    src
Committed By:   chs
Date:           Mon Mar 23 00:37:19 UTC 2020

Modified Files:
        src/sys/dev/acpi: acpi_debug.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/acpi/acpi_debug.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/dev/acpi/acpi_debug.c
diff -u src/sys/dev/acpi/acpi_debug.c:1.6 src/sys/dev/acpi/acpi_debug.c:1.7
--- src/sys/dev/acpi/acpi_debug.c:1.6	Sat Jan  5 20:40:26 2019
+++ src/sys/dev/acpi/acpi_debug.c	Mon Mar 23 00:37:19 2020
@@ -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 <[email protected]>
@@ -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 @@ acpi_debug_init(void)
 	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;
 

Reply via email to