From 27b4a60baf685dd636904277c1fab249c80e5777 Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Mon, 23 Oct 2023 19:47:32 -0600 Subject: [PATCH] mb/prodrive/hermes: Limit amount of data copied into struct Change strcpy to strncpy just to be safe. Found-by: Coverity Scan #1446759 Signed-off-by: Martin Roth Change-Id: I7ed094a313692806a6ab6b4226b9978647e9cb8d Reviewed-on: https://review.coreboot.org/c/coreboot/+/78621 Tested-by: build bot (Jenkins) Reviewed-by: Marshall Dawson --- src/mainboard/prodrive/hermes/mainboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mainboard/prodrive/hermes/mainboard.c b/src/mainboard/prodrive/hermes/mainboard.c index 3173522a77..b0bf0dd986 100644 --- a/src/mainboard/prodrive/hermes/mainboard.c +++ b/src/mainboard/prodrive/hermes/mainboard.c @@ -111,7 +111,7 @@ static void update_board_layout(void) continue; layout.cpu_count++; if (!layout.cpu_name[0]) - strcpy(layout.cpu_name, cpu->name); + strncpy(layout.cpu_name, cpu->name, sizeof(layout.cpu_name)); } if (cpuid_get_max_func() >= 0x16)