From ca2233d33b974c3df81a369adf48fff3d2811342 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Sun, 4 Nov 2018 21:52:26 -0800 Subject: [PATCH] libstrat: Allow nullptr buffers if 0 size. (closes #255) --- include/stratosphere/ipc/ipc_serialization.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/stratosphere/ipc/ipc_serialization.hpp b/include/stratosphere/ipc/ipc_serialization.hpp index 1e4e77af..66225fe6 100644 --- a/include/stratosphere/ipc/ipc_serialization.hpp +++ b/include/stratosphere/ipc/ipc_serialization.hpp @@ -306,9 +306,9 @@ struct Validator { static constexpr bool ValidateCommandArgument(IpcResponseContext *ctx, size_t& a_index, size_t& b_index, size_t& x_index, size_t& h_index, size_t& cur_c_size_offset, size_t& total_c_size) { constexpr ArgType argT = GetArgType(); if constexpr (argT == ArgType::InBuffer) { - return ctx->request.Buffers[a_index] != nullptr && ctx->request.BufferDirections[a_index] == BufferDirection_Send && ctx->request.BufferTypes[a_index++] == T::expected_type; + return (ctx->request.Buffers[a_index] != nullptr || ctx->request.BufferSizes[a_index] == 0) && ctx->request.BufferDirections[a_index] == BufferDirection_Send && ctx->request.BufferTypes[a_index++] == T::expected_type; } else if constexpr (argT == ArgType::OutBuffer) { - return ctx->request.Buffers[b_index] != nullptr && ctx->request.BufferDirections[b_index] == BufferDirection_Recv && ctx->request.BufferTypes[b_index++] == T::expected_type; + return (ctx->request.Buffers[b_index] != nullptr || ctx->request.BufferSizes[b_index] == 0) && ctx->request.BufferDirections[b_index] == BufferDirection_Recv && ctx->request.BufferTypes[b_index++] == T::expected_type; } else if constexpr (argT == ArgType::InPointer) { return ctx->request.Statics[x_index++] != nullptr; } else if constexpr (argT == ArgType::InHandle) {