We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6d14512 commit 755fd29Copy full SHA for 755fd29
src/libstd/ffi/c_str.rs
@@ -311,7 +311,7 @@ impl CString {
311
#[stable(feature = "cstr_memory", since = "1.4.0")]
312
pub unsafe fn from_raw(ptr: *mut c_char) -> CString {
313
let len = libc::strlen(ptr) + 1; // Including the NUL byte
314
- let slice = slice::from_raw_parts(ptr, len as usize);
+ let slice = slice::from_raw_parts_mut(ptr, len as usize);
315
CString { inner: Box::from_raw(slice as *mut [c_char] as *mut [u8]) }
316
}
317
0 commit comments