From 1d4b45954b06fea0d44f7808067316d19e451c64 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 1 Apr 2026 13:52:14 +0000 Subject: [PATCH] [finsh][shell] Avoid prompt format-string injection Agent-Logs-Url: https://github.com/RT-Thread/rt-thread/sessions/b514540d-90fa-4ac9-bb74-5c84dd939b40 Co-authored-by: BernardXiong <1241087+BernardXiong@users.noreply.github.com> --- components/finsh/shell.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/components/finsh/shell.c b/components/finsh/shell.c index c85696ba8a..008d2c3c57 100644 --- a/components/finsh/shell.c +++ b/components/finsh/shell.c @@ -542,7 +542,7 @@ static void finsh_thread_entry(void *parameter) finsh_wait_auth(); #endif - rt_kprintf(FINSH_PROMPT); + rt_kprintf("%s", FINSH_PROMPT); while (1) { @@ -842,7 +842,7 @@ static void finsh_thread_entry(void *parameter) rt_kprintf("\n"); msh_exec(shell->line, shell->line_position); - rt_kprintf(FINSH_PROMPT); + rt_kprintf("%s", FINSH_PROMPT); rt_memset(shell->line, 0, sizeof(shell->line)); shell->line_curpos = shell->line_position = 0; continue; @@ -1019,4 +1019,3 @@ int finsh_system_init(void) INIT_APP_EXPORT(finsh_system_init); #endif /* RT_USING_FINSH */ -