mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-05-05 12:46:14 +02:00
board: samsung: fix set_board_info() board_name buffer overflow
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
This commit is contained in:
parent
f7bef8f81f
commit
e228b6a504
@ -101,7 +101,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",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user