public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 1/3] board: samsung: fix set_board_info() board_name buffer overflow
@ 2026-03-28  6:01 Ngo Luong Thanh Tra
  2026-03-28  6:01 ` [PATCH 2/3] board: toradex: fix tdx-cfg-block prompt " Ngo Luong Thanh Tra
  2026-03-28  6:01 ` [PATCH 3/3] common: cli_hush: fix console_buffer overflow on boot retry Ngo Luong Thanh Tra
  0 siblings, 2 replies; 4+ messages in thread
From: Ngo Luong Thanh Tra @ 2026-03-28  6:01 UTC (permalink / raw)
  To: u-boot; +Cc: Ngo Luong Thanh Tra, Minkyu Kang, Przemyslaw Marczak, Tom Rini

Replace unbounded sprintf() with snprintf() using sizeof(info) as
the bound when constructing the board_name string from bdname and
bdtype. The previous call had no size limit and could overflow the
64-byte stack buffer if the concatenated string exceeded 63 bytes.

Fixes: c9c36bf56e4c ("samsung: misc: use board specific functions to set env board info")
Signed-off-by: Ngo Luong Thanh Tra <S4210155@student.rmit.edu.au>
To: u-boot@lists.denx.de
---

 board/samsung/common/misc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index c134a9d70e2..6718f607875 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -104,7 +104,7 @@ void set_board_info(void)
 	if (!bdtype)
 		bdtype = "";
 
-	sprintf(info, "%s%s", bdname, bdtype);
+	snprintf(info, sizeof(info), "%s%s", bdname, bdtype);
 	env_set("board_name", info);
 #endif
 	snprintf(info, ARRAY_SIZE(info),  "%s%x-%s%s.dtb",
-- 
2.53.0

base-commit: c704af3c8b0f37929bce8c2a4bba27d6e89919c7
branch: fix/sys-cbsize-overflow-series

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

end of thread, other threads:[~2026-03-30 13:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-28  6:01 [PATCH 1/3] board: samsung: fix set_board_info() board_name buffer overflow Ngo Luong Thanh Tra
2026-03-28  6:01 ` [PATCH 2/3] board: toradex: fix tdx-cfg-block prompt " Ngo Luong Thanh Tra
2026-03-28  6:01 ` [PATCH 3/3] common: cli_hush: fix console_buffer overflow on boot retry Ngo Luong Thanh Tra
2026-03-30 12:59   ` Rasmus Villemoes

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