[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250726175524.146459-1-suchitkarunakaran@gmail.com>
Date: Sat, 26 Jul 2025 23:25:24 +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 v2] kconfig/lxdialog: replace strcpy() with strlcpy() in inputbox.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,
prevents overflows, following kernel coding guidelines.
Signed-off-by: Suchit Karunakaran <suchitkarunakaran@...il.com>
Changes since v1:
- Replace strscpy with strlcpy
---
scripts/kconfig/lxdialog/inputbox.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/kconfig/lxdialog/inputbox.c b/scripts/kconfig/lxdialog/inputbox.c
index 3c6e24b20f5b..ca778e270346 100644
--- a/scripts/kconfig/lxdialog/inputbox.c
+++ b/scripts/kconfig/lxdialog/inputbox.c
@@ -40,7 +40,7 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width
if (!init)
instr[0] = '\0';
else
- strcpy(instr, init);
+ strlcpy(instr, init, MAX_LEN + 1);
do_resize:
if (getmaxy(stdscr) <= (height - INPUTBOX_HEIGHT_MIN))
--
2.50.1
Powered by blists - more mailing lists