kernel: Do not error out on zero-length reads/writes to bad addresses
This commit is contained in:
parent
592558d7ad
commit
b7a82fd895
@ -16,6 +16,8 @@ Result<u64> sys_read(Registers*, SyscallArgs args)
|
||||
u8* buf = (u8*)args[1];
|
||||
usize size = (usize)args[2];
|
||||
|
||||
if (!size) return 0;
|
||||
|
||||
if (!MemoryManager::validate_user_write(buf, size)) return err(EFAULT);
|
||||
|
||||
Thread* current = Scheduler::current();
|
||||
@ -44,6 +46,8 @@ Result<u64> sys_write(Registers*, SyscallArgs args)
|
||||
const u8* buf = (const u8*)args[1];
|
||||
usize size = (usize)args[2];
|
||||
|
||||
if (!size) return 0;
|
||||
|
||||
if (!MemoryManager::validate_user_read(buf, size)) return err(EFAULT);
|
||||
|
||||
Thread* current = Scheduler::current();
|
||||
|
Loading…
Reference in New Issue
Block a user