public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] tst_kconfig: Avoid buffer overflow when parsing /proc/cmdline
@ 2024-06-19  7:33 Li Wang
  2024-06-19  7:47 ` Petr Vorel
  0 siblings, 1 reply; 5+ messages in thread
From: Li Wang @ 2024-06-19  7:33 UTC (permalink / raw)
  To: ltp, pvorel

When the test is run with a kernel booting with many parameters, the
buffer size is often not large enough to store the complete command
line. This results in a buffer overflow and the test complains with
the following message:

  tst_kconfig.c:609: TWARN: Buffer overflowed while parsing /proc/cmdline

Signed-off-by: Li Wang <liwang@redhat.com>
---
 lib/tst_kconfig.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/tst_kconfig.c b/lib/tst_kconfig.c
index e16ca1400..be3842c2d 100644
--- a/lib/tst_kconfig.c
+++ b/lib/tst_kconfig.c
@@ -569,7 +569,7 @@ char tst_kconfig_get(const char *confname)
 
 void tst_kcmdline_parse(struct tst_kcmdline_var params[], size_t params_len)
 {
-	char buf[128], line[512];
+	char buf[512], line[512];
 	size_t b_pos = 0,l_pos =0, i;
 	int var_id = -1;
 
-- 
2.45.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

end of thread, other threads:[~2024-06-20  1:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-19  7:33 [LTP] [PATCH] tst_kconfig: Avoid buffer overflow when parsing /proc/cmdline Li Wang
2024-06-19  7:47 ` Petr Vorel
2024-06-19 10:20   ` Li Wang
2024-06-19 13:30     ` Petr Vorel
2024-06-20  1:45       ` Li Wang

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