|
pub fn new(offset: usize, size: usize) -> Self { |
|
let addr = unsafe { EP_MEM_PTR.add(offset) }; |
|
let mem = unsafe { slice::from_raw_parts_mut(addr, size) }; |
|
Self(mem) |
|
} |
|
|
In public accessible function EndpointBuffer::new, it accepts parameters offset and size and used in pointer calculation and slice creation but lack of sufficient checks, which might cause memory issues. In Rust, we should not cause any memory issues if merely using safe functions.
lpc55-hal/src/drivers/usbd/endpoint_memory.rs
Lines 21 to 26 in 1afe02f
In public accessible function EndpointBuffer::new, it accepts parameters offset and size and used in pointer calculation and slice creation but lack of sufficient checks, which might cause memory issues. In Rust, we should not cause any memory issues if merely using safe functions.