diff --git a/src/ffi_util.rs b/src/ffi_util.rs index dfe4756..dc2aa39 100644 --- a/src/ffi_util.rs +++ b/src/ffi_util.rs @@ -29,8 +29,8 @@ pub(crate) unsafe fn raw_data(ptr: *const c_char, size: usize) -> Option None } else { let mut dst = Vec::with_capacity(size); + ptr::copy_nonoverlapping(ptr as *const u8, dst.as_mut_ptr(), size); dst.set_len(size); - ptr::copy(ptr as *const u8, dst.as_mut_ptr(), size); Some(dst) } }