From: Thorsten Blum Date: Tue, 19 Aug 2025 09:59:05 +0000 (+0200) Subject: kdb: Replace deprecated strcpy() with memcpy() in parse_grep() X-Git-Tag: v6.18-rc1~94^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5b26f1a3146454a24dbcb8b1cdae5d507f7432e6;p=thirdparty%2Fkernel%2Fstable.git kdb: Replace deprecated strcpy() with memcpy() in parse_grep() strcpy() is deprecated; use memcpy() instead. We can safely use memcpy() because we already know the length of the source string 'cp' and that it is guaranteed to be NUL-terminated within the first KDB_GREP_STRLEN bytes. Link: https://github.com/KSPP/linux/issues/88 Reviewed-by: Douglas Anderson Signed-off-by: Thorsten Blum Signed-off-by: Daniel Thompson (RISCstar) --- diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c index 7a4d2d4689a57..cdf91976eb7cd 100644 --- a/kernel/debug/kdb/kdb_main.c +++ b/kernel/debug/kdb/kdb_main.c @@ -860,7 +860,7 @@ static void parse_grep(const char *str) kdb_printf("search string too long\n"); return; } - strcpy(kdb_grep_string, cp); + memcpy(kdb_grep_string, cp, len + 1); kdb_grepping_flag++; return; }