linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kconfig/lxdialog: replace strcpy() with strscpy() in inputbox.c
@ 2025-07-25  5:59 Suchit Karunakaran
  2025-07-25  9:53 ` Franco Martelli
  2025-07-25 13:00 ` Nicolas Schier
  0 siblings, 2 replies; 7+ messages in thread
From: Suchit Karunakaran @ 2025-07-25  5:59 UTC (permalink / raw)
  To: masahiroy, linux-kbuild; +Cc: linux-kernel, skhan, Suchit Karunakaran

strcpy() performs no bounds checking and can lead to buffer overflows if
the input string exceeds the destination buffer size. Replace it with
strscpy(), which ensures the input is always NULL-terminated and
prevents overflows.

Signed-off-by: Suchit Karunakaran <suchitkarunakaran@gmail.com>
---
 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..8880ccaffa0b 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);
+		strscpy(instr, init, MAX_LEN + 1);
 
 do_resize:
 	if (getmaxy(stdscr) <= (height - INPUTBOX_HEIGHT_MIN))
-- 
2.39.5


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

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

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-25  5:59 [PATCH] kconfig/lxdialog: replace strcpy() with strscpy() in inputbox.c Suchit Karunakaran
2025-07-25  9:53 ` Franco Martelli
2025-07-25 10:11   ` Suchit K
2025-07-25 13:00 ` Nicolas Schier
2025-07-25 14:36   ` Suchit K
2025-07-26 16:59     ` Nicolas Schier
2025-07-26 17:06       ` Suchit K

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).