Skip to content

Commit

Permalink
Zero the REPARSE_MOUNTPOINT_DATA_BUFFER header
Browse files Browse the repository at this point in the history
Makes sure the full header is correctly initialized, including reserve parameters.
  • Loading branch information
ChrisDenton committed Feb 10, 2023
1 parent d1ac43a commit 59b11e8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions library/std/src/sys/windows/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 59b11e8

Please sign in to comment.