mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-05-28 15:34: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;
|
vfs::FileDescriptorTable *fdt = pcb->FileDescriptors;
|
||||||
Memory::VirtualMemoryArea *vma = pcb->vma;
|
Memory::VirtualMemoryArea *vma = pcb->vma;
|
||||||
|
|
||||||
auto pArgp = vma->UserCheckAndGetAddress(argp);
|
void *pArgp = nullptr;
|
||||||
if (pArgp == nullptr)
|
if (argp != nullptr)
|
||||||
return -linux_EFAULT;
|
{
|
||||||
|
pArgp = vma->UserCheckAndGetAddress(argp);
|
||||||
|
if (pArgp == nullptr)
|
||||||
|
return -linux_EFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
int ret = ConvertErrnoToLinux(fdt->usr_ioctl(fd, request, pArgp));
|
int ret = ConvertErrnoToLinux(fdt->usr_ioctl(fd, request, pArgp));
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user