diff options
| author | Yudistira Putra <[email protected]> | 2026-07-19 06:11:25 -0400 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2026-08-31 18:08:50 +0530 |
| commit | f95648d3955d72f77e13315a990a6135303978a5 (patch) | |
| tree | a492dcfae7d4ada5abdb8e6736a9dd30e29bf17a /lib/utils/suspend/fdt_suspend_andes_atcsmu.c | |
| parent | 4e79fd7de59f1b2899092c1a84ce68c8ebc68f93 (diff) | |
sbi_ecall_get_extensions_str() advanced offset by the nominal extension
name length without checking remaining capacity. When the caller buffer
was smaller than the concatenated extension list, offset could pass
exts_str_size, so (exts_str_size - offset) became negative and was
passed to sbi_snprintf() as a large u32, and the trailing NUL write
could step past the caller buffer.
The helper can write beyond a caller-provided destination when the
registered extension list exceeds the supplied capacity.
Mirror the guard already used by sbi_hart_get_extensions_str(): stop
appending when the next name would not fit. Add an SBIUNIT regression
that registers several extensions into a 16-byte buffer with a redzone
and verifies no out-of-bounds write.
Closes: https://github.com/riscv-software-src/opensbi/issues/416
Signed-off-by: Yudistira Putra <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Anup Patel <[email protected]>
Diffstat (limited to 'lib/utils/suspend/fdt_suspend_andes_atcsmu.c')
0 files changed, 0 insertions, 0 deletions
