drivers/tty/serial/kgdboc: Use strscpy() to copy strings into arrays

Replacing strcpy() with strscpy() ensures that overflow of the target
buffer cannot happen.

Signed-off-by: David Laight <david.laight.linux@gmail.com>
Reviewed-by: Daniel Thompson (RISCstar) <danielt@kernel.org>
Link: https://patch.msgid.link/20260608095523.2606-10-david.laight.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
David Laight
2026-06-08 10:54:54 +01:00
committed by Greg Kroah-Hartman
parent 970ede67de
commit 383f139f19

View File

@@ -363,7 +363,7 @@ static int param_set_kgdboc_var(const char *kmessage,
mutex_lock(&config_mutex);
strcpy(config, kmessage);
strscpy(config, kmessage);
/* Chop out \n char as a result of echo */
if (len && config[len - 1] == '\n')
config[len - 1] = '\0';