Fix work_dir validation in umount() to guard all uses, not just rmdir#1139
Merged
zhblue merged 2 commits intoAI-patch-2from Mar 25, 2026
Merged
Fix work_dir validation in umount() to guard all uses, not just rmdir#1139zhblue merged 2 commits intoAI-patch-2from
zhblue merged 2 commits intoAI-patch-2from
Conversation
Merged
Copilot
AI
changed the title
[WIP] [WIP] Address changes based on feedback from PR #1138 review
Fix work_dir validation in umount() to guard all uses, not just rmdir
Mar 25, 2026
zhblue
added a commit
that referenced
this pull request
Mar 25, 2026
* Add files via upload * Fix formatting in judge_client.cc debug prints * Update trunk/core/judge_client/judge_client.cc Co-authored-by: Copilot <[email protected]> * Update trunk/core/judge_client/judge_client.cc Co-authored-by: Copilot <[email protected]> * Fix work_dir validation in umount() to guard all uses, not just rmdir (#1139) * Initial plan * Move work_dir validation to start of umount() before any use Co-authored-by: zhblue <[email protected]> Agent-Logs-Url: https://github.com/zhblue/hustoj/sessions/1074fa3b-637f-456a-ad51-6cc660b292c9 --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: zhblue <[email protected]> --------- Co-authored-by: Copilot <[email protected]> Co-authored-by: Copilot <[email protected]> Co-authored-by: zhblue <[email protected]>
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
work_dirsafety guard inumount()was placed only around the trailingrmdircalls, leaving earlier uses ofwork_dir—chdir(),strlen(), and multipleexecute_cmd()calls (which invokesystem()) — completely unprotected against NULL or shell-injectable input.Changes
umount()before any use ofwork_dirstrlencheck and the lateifblock aroundrmdir; the single upfront check now covers the entire function body⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.