[PATCH 6/8] MIPS: cavium-octeon: bound default console command-line append
From: Pengpeng Hou
Date: Sat Apr 04 2026 - 22:34:48 EST
setup_octeon_cmdline() already bounds most copied firmware arguments,
but the fallback default console append still uses unchecked strcat(). If
the command line is already near the end of the fixed buffer, the default
console string can run past the buffer boundary.
Use bounded concatenation for the default console fallback.
Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
---
arch/mips/cavium-octeon/setup.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index 1ad2602a0383..87f34bc20896 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -898,9 +898,11 @@ void __init prom_init(void)
if (strstr(arcs_cmdline, "console=") == NULL) {
if (octeon_uart == 1)
- strcat(arcs_cmdline, " console=ttyS1,115200");
+ strlcat(arcs_cmdline, " console=ttyS1,115200",
+ COMMAND_LINE_SIZE);
else
- strcat(arcs_cmdline, " console=ttyS0,115200");
+ strlcat(arcs_cmdline, " console=ttyS0,115200",
+ COMMAND_LINE_SIZE);
}
mips_hpt_frequency = octeon_get_clock_rate();
--
2.50.1 (Apple Git-155)