aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/service/nfp/nfp_user.cpp
diff options
context:
space:
mode:
authorNarr the Reg <juangerman-13@hotmail.com>2022-10-03 18:06:55 -0500
committerNarr the Reg <juangerman-13@hotmail.com>2022-10-03 18:06:55 -0500
commite85c19adcb71149922332150d45d671f90bd1f9f (patch)
tree39797c4c6e70786fe2e4a6aba643c48db8f33be7 /src/core/hle/service/nfp/nfp_user.cpp
parent61399de5dbc64ada1c9e5ec3d84be76c215fdc0c (diff)
service: nfp: Fix errors to pass unit testing
Diffstat (limited to 'src/core/hle/service/nfp/nfp_user.cpp')
-rw-r--r--src/core/hle/service/nfp/nfp_user.cpp30
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()) {