fix(kernel/syscalls): add null check for argp in linux_ioctl function

Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
EnderIce2 2025-03-27 16:41:58 +00:00
parent b74d4db23b
commit ad0c1e15e0
Signed by: enderice2
GPG Key ID: FEB6B8A8507BA62E

View File

@ -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;