From 1376c5a617be5c25655d0d7cb63e3beaa5a6e026 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:20:39 +0200 Subject: Merging upstream version 1.70.0+dfsg1. Signed-off-by: Daniel Baumann --- vendor/rustix/src/path/arg.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'vendor/rustix/src/path/arg.rs') diff --git a/vendor/rustix/src/path/arg.rs b/vendor/rustix/src/path/arg.rs index 0ea673d19..3d976ce3e 100644 --- a/vendor/rustix/src/path/arg.rs +++ b/vendor/rustix/src/path/arg.rs @@ -41,7 +41,7 @@ use std::path::{Component, Components, Iter, Path, PathBuf}; /// /// # Example /// -/// ```rust +/// ``` /// # #[cfg(any(feature = "fs", feature = "net"))] /// use rustix::ffi::CStr; /// use rustix::io; @@ -950,13 +950,15 @@ where } // Taken from - // https://github.com/rust-lang/rust/blob/a00f8ba7fcac1b27341679c51bf5a3271fa82df3/library/std/src/sys/common/small_c_string.rs + // let mut buf = MaybeUninit::<[u8; SMALL_PATH_BUFFER_SIZE]>::uninit(); let buf_ptr = buf.as_mut_ptr() as *mut u8; + // This helps test our safety condition below. + debug_assert!(bytes.len() + 1 <= SMALL_PATH_BUFFER_SIZE); + // SAFETY: bytes.len() < SMALL_PATH_BUFFER_SIZE which means we have space for // bytes.len() + 1 u8s: - debug_assert!(bytes.len() + 1 <= SMALL_PATH_BUFFER_SIZE); unsafe { ptr::copy_nonoverlapping(bytes.as_ptr(), buf_ptr, bytes.len()); buf_ptr.add(bytes.len()).write(0); -- cgit v1.2.3