From 7e3561b1cd3175d4e3104f03498adf03aca469bf Mon Sep 17 00:00:00 2001
From: Subv <subv2112@gmail.com>
Date: Sun, 7 Jan 2018 01:59:31 -0500
Subject: [PATCH] IPC: Don't attempt to read  the command buffer if it holds a
 Close request.

---
 src/core/hle/kernel/hle_ipc.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp
index 518e44f338..0ab28c0a2e 100644
--- a/src/core/hle/kernel/hle_ipc.cpp
+++ b/src/core/hle/kernel/hle_ipc.cpp
@@ -102,6 +102,11 @@ ResultCode HLERequestContext::PopulateFromIncomingCommandBuffer(u32_le* src_cmdb
                                                                 Process& src_process,
                                                                 HandleTable& src_table) {
     ParseCommandBuffer(src_cmdbuf, true);
+    if (command_header->type == IPC::CommandType::Close) {
+        // Close does not populate the rest of the IPC header
+        return RESULT_SUCCESS;
+    }
+
     // The data_size already includes the payload header, the padding and the domain header.
     size_t size = data_payload_offset + command_header->data_size -
                   sizeof(IPC::DataPayloadHeader) / sizeof(u32) - 4;