fix(call): verify flags in call_{ro,wo}
Bail if `CallFlags::READ` is set in `call_wo` as that will allow the caller to mutate immutable slices. Similarly, bail if `CallFlags::WRITE` is set in `call_ro`. Signed-off-by: Anhad Singh <andypython@protonmail.com> Co-authored-by: @4lDO2
This commit is contained in:
@@ -662,6 +662,9 @@ pub mod call {
|
||||
flags: syscall::CallFlags,
|
||||
metadata: &[u64],
|
||||
) -> Result<usize> {
|
||||
if flags.contains(syscall::CallFlags::WRITE) {
|
||||
return Err(Error::new(syscall::EINVAL));
|
||||
}
|
||||
unsafe {
|
||||
fd.raw_call(
|
||||
payload.as_mut_ptr(),
|
||||
@@ -679,6 +682,9 @@ pub mod call {
|
||||
flags: syscall::CallFlags,
|
||||
metadata: &[u64],
|
||||
) -> Result<usize> {
|
||||
if flags.contains(syscall::CallFlags::READ) {
|
||||
return Err(Error::new(syscall::EINVAL));
|
||||
}
|
||||
unsafe {
|
||||
fd.raw_call(
|
||||
payload.as_ptr().cast_mut(),
|
||||
|
||||
Reference in New Issue
Block a user