mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-05-27 15:04:31 +00:00
fix(kernel/syscalls): add null check for argp in linux_ioctl function
Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
parent
b74d4db23b
commit
ad0c1e15e0
@ -1146,9 +1146,13 @@ static int linux_ioctl(SysFrm *, int fd, unsigned long request, void *argp)
|
||||
vfs::FileDescriptorTable *fdt = pcb->FileDescriptors;
|
||||
Memory::VirtualMemoryArea *vma = pcb->vma;
|
||||
|
||||
auto pArgp = vma->UserCheckAndGetAddress(argp);
|
||||
if (pArgp == nullptr)
|
||||
return -linux_EFAULT;
|
||||
void *pArgp = nullptr;
|
||||
if (argp != nullptr)
|
||||
{
|
||||
pArgp = vma->UserCheckAndGetAddress(argp);
|
||||
if (pArgp == nullptr)
|
||||
return -linux_EFAULT;
|
||||
}
|
||||
|
||||
int ret = ConvertErrnoToLinux(fdt->usr_ioctl(fd, request, pArgp));
|
||||
return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user