Skip to content

std: reject interior NULs in Windows chdir#543

Open
SebTardif wants to merge 1 commit into
mainfrom
fix/win-chdir-nul
Open

std: reject interior NULs in Windows chdir#543
SebTardif wants to merge 1 commit into
mainfrom
fix/win-chdir-nul

Conversation

@SebTardif

@SebTardif SebTardif commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Summary

Route Windows chdir through to_u16s so interior NULs are rejected.

Problem

encode_wide + trailing zero allowed embedded NULs; SetCurrentDirectoryW truncated silently.

Change

library/std/src/sys/paths/windows.rs: to_u16s(p)? then SetCurrentDirectoryW.

Origin

Lines Commit Date Author
106-111 2d200c9c8bd 2015-02-23 Alex Crichton

Closes #542

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
@SebTardif SebTardif added bug Something isn't working I-wrong Wrong result or data corruption P-low Low impact: edge case or niche scenario O-windows Windows-specific A-libs Standard library labels Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-libs Standard library bug Something isn't working I-wrong Wrong result or data corruption O-windows Windows-specific P-low Low impact: edge case or niche scenario

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows chdir/set_current_dir does not reject interior NUL (silent truncation)

1 participant