Merge pull request #12203 from deReeperJosh/hidv4-check-device-not-null

HIDv4: Check Device Not Null Before Attaching
This commit is contained in:
Admiral H. Curtiss 2023-09-27 23:06:47 +02:00 committed by GitHub
commit 467c7435d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -59,6 +59,8 @@ std::optional<IPCReply> USB_HIDv4::IOCtl(const IOCtlRequest& request)
if (request.buffer_in == 0 || request.buffer_in_size != 32) if (request.buffer_in == 0 || request.buffer_in_size != 32)
return IPCReply(IPC_EINVAL); return IPCReply(IPC_EINVAL);
const auto device = GetDeviceByIOSID(memory.Read_U32(request.buffer_in + 16)); const auto device = GetDeviceByIOSID(memory.Read_U32(request.buffer_in + 16));
if (!device)
return IPCReply(IPC_ENOENT);
if (!device->Attach()) if (!device->Attach())
return IPCReply(IPC_EINVAL); return IPCReply(IPC_EINVAL);
return HandleTransfer(device, request.request, return HandleTransfer(device, request.request,