From 09bcd2127ffe6c6b54dc42693ddc920cb759d09d Mon Sep 17 00:00:00 2001 From: Thomas de Zeeuw Date: Sat, 24 May 2025 11:26:02 +0200 Subject: [PATCH] Update to Windows-sys v0.59 --- Cargo.toml | 2 +- src/sys/windows.rs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1b509fb3..2d71991e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,7 +54,7 @@ features = ["all"] libc = "0.2.172" [target.'cfg(windows)'.dependencies.windows-sys] -version = "0.52" +version = "0.59" features = [ "Win32_Foundation", "Win32_Networking_WinSock", diff --git a/src/sys/windows.rs b/src/sys/windows.rs index 4638314f..6de43138 100644 --- a/src/sys/windows.rs +++ b/src/sys/windows.rs @@ -938,9 +938,11 @@ pub(crate) fn unix_sockaddr(path: &Path) -> io::Result { } storage.sun_family = crate::sys::AF_UNIX as sa_family_t; + // SAFETY: casting `[u8]` to `[i8]` is safe. + let b = unsafe { &*(bytes as *const [u8] as *const [i8]) }; // `storage` was initialized to zero above, so the path is // already null terminated. - storage.sun_path[..bytes.len()].copy_from_slice(bytes); + storage.sun_path[..bytes.len()].copy_from_slice(b); let base = storage as *const _ as usize; let path = &storage.sun_path as *const _ as usize;