mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 15:22:21 -04:00
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:
committed by
Greg Kroah-Hartman
parent
970ede67de
commit
383f139f19
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user