[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250726191515.171012-1-suchitkarunakaran@gmail.com>
Date: Sun, 27 Jul 2025 00:45:15 +0530
From: Suchit Karunakaran <suchitkarunakaran@...il.com>
To: masahiroy@...nel.org,
nicolas.schier@...ux.dev,
linux-kbuild@...r.kernel.org
Cc: skhan@...uxfoundation.org,
linux-kernel-mentees@...ts.linux.dev,
linux-kernel@...r.kernel.org,
Suchit Karunakaran <suchitkarunakaran@...il.com>
Subject: [PATCH] kconfig: replace strcpy() with strlcpy() in symbol.c
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@...il.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
Powered by blists - more mailing lists