diff options
| author | Chris Denton <chris@chrisdenton.dev> | 2023-02-10 18:07:23 +0000 |
|---|---|---|
| committer | Chris Denton <chris@chrisdenton.dev> | 2023-02-10 18:14:53 +0000 |
| commit | 59b11e8fa39090f555b8d91eb0c359ad0adaabc4 (patch) | |
| tree | 6fedc9282451cf3ebd1570f68dabe09c836e8e2a | |
| parent | d1ac43a9b9a8250d858705b0796dfed6186e18db (diff) | |
Zero the `REPARSE_MOUNTPOINT_DATA_BUFFER` header
Makes sure the full header is correctly initialized, including reserve parameters.
| -rw-r--r-- | library/std/src/sys/windows/fs.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/library/std/src/sys/windows/fs.rs b/library/std/src/sys/windows/fs.rs index 37809803828..f1a784b5fd2 100644 --- a/library/std/src/sys/windows/fs.rs +++ b/library/std/src/sys/windows/fs.rs @@ -1393,6 +1393,8 @@ fn symlink_junction_inner(original: &Path, junction: &Path) -> io::Result<()> { let mut data = Align8([MaybeUninit::<u8>::uninit(); c::MAXIMUM_REPARSE_DATA_BUFFER_SIZE]); let data_ptr = data.0.as_mut_ptr(); let db = data_ptr.cast::<c::REPARSE_MOUNTPOINT_DATA_BUFFER>(); + // Zero the header to ensure it's fully initialized, including reserved parameters. + *db = mem::zeroed(); let buf = ptr::addr_of_mut!((*db).ReparseTarget).cast::<c::WCHAR>(); let mut i = 0; // FIXME: this conversion is very hacky |
