public inbox for linux-kernel-mentees@lists.linux-foundation.org
 help / color / mirror / Atom feed
* [PATCH] kconfig: replace strcpy() with strlcpy() in symbol.c
@ 2025-07-26 19:15 Suchit Karunakaran
  2025-07-26 20:38 ` kernel test robot
  0 siblings, 1 reply; 2+ messages in thread
From: Suchit Karunakaran @ 2025-07-26 19:15 UTC (permalink / raw)
  To: masahiroy, nicolas.schier, linux-kbuild
  Cc: skhan, linux-kernel-mentees, linux-kernel, Suchit Karunakaran

strcpy() performs no bounds checking and can lead to buffer overflows if
the input string exceeds the destination buffer size. This patch replaces
it with strlcpy(), which ensures the input is always NULL-terminated and
prevents overflows, following kernel coding guidelines.

Signed-off-by: Suchit Karunakaran <suchitkarunakaran@gmail.com>
---
 scripts/kconfig/symbol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 26ab10c0fd76..c44e8ac3e9fe 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -777,7 +777,7 @@ bool sym_set_string_value(struct symbol *sym, const char *newval)
 	else
 		return true;
 
-	strcpy(val, newval);
+	strlcpy(val, newval, size);
 	free((void *)oldval);
 	sym_clear_all_valid();
 
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-26 20:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-26 19:15 [PATCH] kconfig: replace strcpy() with strlcpy() in symbol.c Suchit Karunakaran
2025-07-26 20:38 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox