shell: harden path normalization to avoid crashes in writeo flows#8
shell: harden path normalization to avoid crashes in writeo flows#8AMDRIP wants to merge 1 commit intoPOSIX-Implementationfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 354aec4fe8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (num_parts >= 32) { | ||
| // Path is deeper than we can represent in the shell resolver. | ||
| // Skip the rest to avoid stack corruption. | ||
| while (curr < temp_len && temp[curr] != '/') curr++; | ||
| continue; |
There was a problem hiding this comment.
Keep processing
.. once path depth reaches cap
When num_parts hits 32, this branch skips every remaining segment without inspecting its value, so later .. components are ignored instead of popping depth. In deep but valid paths like /a/.../z/../target (where the cap is reached before ..), resolve_path() now normalizes to the wrong directory and write flows can operate on an unintended path; this is a functional regression introduced by the new early continue.
Useful? React with 👍 / 👎.
Motivation
writeo/writei) callresolve_path()with very deep or malformed paths.Description
resolve_path()to stop accumulatingpartsoncenum_partswould exceed theparts[32][32]capacity to avoid writing past the local stack array./separator instead of leaving the cursor mid-segment.outputbuffer.Testing
./build.shwhich initially failed due to execution permission on the script (Permission denied).bash ./build.shwhich completed kernel compile and link steps (warnings only) but the final image creation step failed becausemkfs.fatis not available in the environment, so no full image test was produced.Codex Task