Skip to content

Commit

Permalink
fix UAF in doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
Freax13 committed Jul 3, 2022
1 parent b9e0607 commit 980f3c3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,8 @@ impl<R, W> VolatilePtr<'_, [u8], Access<R, W>> {
/// use volatile::VolatilePtr;
/// use core::ptr::NonNull;
///
/// let mut buf = unsafe { VolatilePtr::new_read_write(NonNull::from(vec![0; 10].as_mut_slice())) };
/// let mut vec = vec![0; 10];
/// let mut buf = unsafe { VolatilePtr::new_read_write(NonNull::from(vec.as_mut_slice())) };
/// buf.fill(1);
/// assert_eq!(unsafe { buf.as_ptr().as_mut() }, &mut vec![1; 10]);
/// ```
Expand Down

0 comments on commit 980f3c3

Please sign in to comment.