[finsh][shell] Print FinSH prompt with a fixed format string#11307
Draft
[finsh][shell] Print FinSH prompt with a fixed format string#11307
Conversation
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>
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>
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
AI
changed the title
[WIP] Fix format-string injection in FinSH prompt
[finsh][shell] Print FinSH prompt with a fixed format string
Apr 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The FinSH/MSH prompt path treated the prompt buffer as a
rt_kprintf()format string. When the working directory contained format specifiers, the prompt could leak stack data or crash instead of printing the path literally.Problem
finsh_get_prompt()builds the prompt from static text plus the current working directory.components/finsh/shell.cthen printed that buffer directly withrt_kprintf(FINSH_PROMPT), making directory names part of the format string.Change
components/finsh/shell.cto use a fixed format string.Effect
rt_kprintf().