mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02: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:
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';
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user