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 781cbf6 commit f3b0cb5Copy full SHA for f3b0cb5
library/std/src/sys/sgx/abi/usercalls/alloc.rs
@@ -225,13 +225,9 @@ where
225
/// Copies `val` into freshly allocated space in user memory.
226
pub fn new_from_enclave(val: &T) -> Self {
227
unsafe {
228
- let ret = Self::new_uninit_bytes(mem::size_of_val(val));
229
- ptr::copy(
230
- val as *const T as *const u8,
231
- ret.0.as_ptr() as *mut u8,
232
- mem::size_of_val(val),
233
- );
234
- ret
+ let mut user = Self::new_uninit_bytes(mem::size_of_val(val));
+ user.copy_from_enclave(val);
+ user
235
}
236
237
0 commit comments