htc: fixes for WriteFileLarge/sending over data channel

This commit is contained in:
Michael Scire 2021-02-16 17:15:57 -08:00 committed by SciresM
parent 7621bd4e13
commit f0ef9fb918
3 changed files with 10 additions and 4 deletions

View file

@ -429,11 +429,13 @@ namespace ams::htcfs {
R_TRY(this->CheckResponseHeader(response, request.packet_type));
/* Check the response body size. */
R_UNLESS(response.body_size > 0, htcfs::ResultUnexpectedResponseBodySize());
R_UNLESS(response.body_size >= 0, htcfs::ResultUnexpectedResponseBodySize());
R_UNLESS(static_cast<size_t>(response.body_size) <= MaxPacketBodySize, htcfs::ResultUnexpectedResponseBodySize());
/* Receive the response body. */
R_TRY(this->ReceiveFromRpcChannel(m_packet_buffer, response.body_size));
if (response.body_size > 0) {
R_TRY(this->ReceiveFromRpcChannel(m_packet_buffer, response.body_size));
}
/* Check that we succeeded. */
R_TRY(ConvertHtcfsResult(response.params[0]));
@ -1332,7 +1334,7 @@ namespace ams::htcfs {
m_header_factory.MakeWriteFileLargeHeader(std::addressof(request), handle, option.value, offset, buffer_size, DataChannelId);
/* Send the request to the host. */
R_TRY(this->SendRequest(request, buffer, buffer_size));
R_TRY(this->SendRequest(request));
/* Receive response from the host. */
R_TRY(this->ReceiveFromRpcChannel(std::addressof(response), sizeof(response)));
@ -1537,4 +1539,5 @@ namespace ams::htcfs {
return ResultSuccess();
}
}