diff options
| author | Ngo Luong Thanh Tra <[email protected]> | 2026-08-10 15:08:27 +0700 |
|---|---|---|
| committer | Patrice Chotard <[email protected]> | 2026-08-31 10:01:44 +0200 |
| commit | 7a347e80b6c3b98169d593949dc701ca838ee3b1 (patch) | |
| tree | cd5c3667f89c08a3510c8e384441c9dcba827a9c /contrib/apps/httpserver/README | |
| parent | 964ad5b5c91b7be56e443e899d7f873e6aa8c9fc (diff) | |
ram: stm32mp1: bound the invalid-argument message in stm32mp1_ddr_subcmd()
stm32mp1_ddr_subcmd() formats a rejected argument into a 50-byte stack
buffer with an unbounded sprintf():
char string[50] = "";
...
sprintf(string, "invalid argument %s", argv[1]);
argv[1] comes from cli_simple_parse_line() over a console line held in
buffer[CONFIG_SYS_CBSIZE], which is commonly 256 bytes or more. The
fixed prefix takes 17 bytes, leaving 32 for the argument and its NUL, so
any invalid argument longer than 32 characters writes past the end of
string and corrupts the stack of the DDR interactive console.
Use snprintf() with sizeof(string). The sibling call a few lines below
formats only integers and cannot overflow, so it is left alone.
Fixes: 0d447524425e ("stm32mp1: ram: add tests in DDR interactive mode")
Signed-off-by: Ngo Luong Thanh Tra <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Tom Rini <[email protected]>
Reviewed-by: Patrice Chotard <[email protected]>
Diffstat (limited to 'contrib/apps/httpserver/README')
0 files changed, 0 insertions, 0 deletions
