Skip to content

std: reject interior NULs in Windows env::set_current_dir / chdir#600

Open
SebTardif wants to merge 1 commit into
mainfrom
fix-r75-windows-chdir-nul
Open

std: reject interior NULs in Windows env::set_current_dir / chdir#600
SebTardif wants to merge 1 commit into
mainfrom
fix-r75-windows-chdir-nul

Conversation

@SebTardif

Copy link
Copy Markdown
Owner

Fixes #597

Summary

Route Windows chdir through to_u16s so interior NULs are rejected before SetCurrentDirectoryW, consistent with other WinAPI path helpers.

Origin

External-input audit (Windows path / WinAPI string truncation), SebTardif/rust.

Test plan

  • Windows-only; normal paths behave as before (trailing NUL added by to_u16s).
  • Path with interior NUL should return InvalidInput instead of truncating cwd.

chdir built the wide path with encode_wide plus a trailing 0 only, so an
interior NUL truncated SetCurrentDirectoryW. Route through to_u16s which
rejects NULs and appends the terminator.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows env::set_current_dir / chdir does not reject interior NUL before SetCurrentDirectoryW

1 participant