From 9e633999d6ffb64c9c21ac7f4b9be565fdec8e05 Mon Sep 17 00:00:00 2001 From: Valeri Date: Tue, 15 Mar 2022 14:06:34 +0300 Subject: bsd: Allow inexact match for address length in AcceptImpl Minecraft passes in zero for length, but this should account for all possible cases --- src/core/hle/service/sockets/bsd.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp index f83272633..3dbac5a23 100644 --- a/src/core/hle/service/sockets/bsd.cpp +++ b/src/core/hle/service/sockets/bsd.cpp @@ -569,9 +569,9 @@ std::pair BSD::AcceptImpl(s32 fd, std::vector& write_buffer) { new_descriptor.socket = std::move(result.socket); new_descriptor.is_connection_based = descriptor.is_connection_based; - ASSERT(write_buffer.size() == sizeof(SockAddrIn)); const SockAddrIn guest_addr_in = Translate(result.sockaddr_in); - std::memcpy(write_buffer.data(), &guest_addr_in, sizeof(guest_addr_in)); + const size_t length = std::min(sizeof(guest_addr_in), write_buffer.size()); + std::memcpy(write_buffer.data(), &guest_addr_in, length); return {new_fd, Errno::SUCCESS}; } -- cgit v1.2.3