diff options
author | bunnei <bunneidev@gmail.com> | 2022-10-05 23:13:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-05 23:13:57 +0200 |
commit | 1689530f520f72ca198de421519fd2d6658af2d1 (patch) | |
tree | 3daa0c297084278fdb67b8f3d1f61ca62794b870 /src/core/hle/service/nfp/nfp_user.cpp | |
parent | Show error from cpp-httplib when we don't have a response to read (report errors while connecting to API) (#8999) (diff) | |
parent | service: nfp: Fix errors to pass unit testing (diff) | |
download | yuzu-1689530f520f72ca198de421519fd2d6658af2d1.tar yuzu-1689530f520f72ca198de421519fd2d6658af2d1.tar.gz yuzu-1689530f520f72ca198de421519fd2d6658af2d1.tar.bz2 yuzu-1689530f520f72ca198de421519fd2d6658af2d1.tar.lz yuzu-1689530f520f72ca198de421519fd2d6658af2d1.tar.xz yuzu-1689530f520f72ca198de421519fd2d6658af2d1.tar.zst yuzu-1689530f520f72ca198de421519fd2d6658af2d1.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/nfp/nfp_user.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/core/hle/service/nfp/nfp_user.cpp b/src/core/hle/service/nfp/nfp_user.cpp index c61df9401..4ed53b534 100644 --- a/src/core/hle/service/nfp/nfp_user.cpp +++ b/src/core/hle/service/nfp/nfp_user.cpp @@ -93,6 +93,18 @@ void IUser::ListDevices(Kernel::HLERequestContext& ctx) { return; } + if (!ctx.CanWriteBuffer()) { + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(InvalidArgument); + return; + } + + if (ctx.GetWriteBufferSize() == 0) { + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(InvalidArgument); + return; + } + std::vector<u64> nfp_devices; const std::size_t max_allowed_devices = ctx.GetWriteBufferSize() / sizeof(u64); @@ -255,6 +267,12 @@ void IUser::GetApplicationArea(Kernel::HLERequestContext& ctx) { return; } + if (!ctx.CanWriteBuffer()) { + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(InvalidArgument); + return; + } + auto device = GetNfpDevice(device_handle); if (!device.has_value()) { @@ -283,6 +301,12 @@ void IUser::SetApplicationArea(Kernel::HLERequestContext& ctx) { return; } + if (!ctx.CanReadBuffer()) { + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(InvalidArgument); + return; + } + auto device = GetNfpDevice(device_handle); if (!device.has_value()) { @@ -358,6 +382,12 @@ void IUser::CreateApplicationArea(Kernel::HLERequestContext& ctx) { return; } + if (!ctx.CanReadBuffer()) { + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(InvalidArgument); + return; + } + auto device = GetNfpDevice(device_handle); if (!device.has_value()) { |