Sfoglia il codice sorgente

[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>
copilot-swe-agent[bot] 1 settimana fa
parent
commit
1d4b45954b
1 ha cambiato i file con 2 aggiunte e 3 eliminazioni
  1. 2 3
      components/finsh/shell.c

+ 2 - 3
components/finsh/shell.c

@@ -542,7 +542,7 @@ static void finsh_thread_entry(void *parameter)
     finsh_wait_auth();
     finsh_wait_auth();
 #endif
 #endif
 
 
-    rt_kprintf(FINSH_PROMPT);
+    rt_kprintf("%s", FINSH_PROMPT);
 
 
     while (1)
     while (1)
     {
     {
@@ -842,7 +842,7 @@ static void finsh_thread_entry(void *parameter)
                 rt_kprintf("\n");
                 rt_kprintf("\n");
             msh_exec(shell->line, shell->line_position);
             msh_exec(shell->line, shell->line_position);
 
 
-            rt_kprintf(FINSH_PROMPT);
+            rt_kprintf("%s", FINSH_PROMPT);
             rt_memset(shell->line, 0, sizeof(shell->line));
             rt_memset(shell->line, 0, sizeof(shell->line));
             shell->line_curpos = shell->line_position = 0;
             shell->line_curpos = shell->line_position = 0;
             continue;
             continue;
@@ -1019,4 +1019,3 @@ int finsh_system_init(void)
 INIT_APP_EXPORT(finsh_system_init);
 INIT_APP_EXPORT(finsh_system_init);
 
 
 #endif /* RT_USING_FINSH */
 #endif /* RT_USING_FINSH */
-