From 8d98a387ac570c7f3ee77f8659e13bc12e33ed50 Mon Sep 17 00:00:00 2001 From: Nguyen Dac Nam Date: Tue, 21 Aug 2018 21:39:45 +0700 Subject: [PATCH] only get src_adr if input_adr available --- src/core/hle/service/soc_u.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cpp index f084a4a1f..30b19c254 100644 --- a/src/core/hle/service/soc_u.cpp +++ b/src/core/hle/service/soc_u.cpp @@ -579,13 +579,18 @@ void SOC_U::RecvFromOther(Kernel::HLERequestContext& ctx) { std::vector addr_buff(sizeof(ctr_src_addr)); sockaddr src_addr; socklen_t src_addr_len = sizeof(src_addr); - s32 ret = ::recvfrom(socket_handle, reinterpret_cast(output_buff.data()), len, flags, + + s32 ret = -1; + if (addr_len > 0) { + ret = ::recvfrom(socket_handle, reinterpret_cast(output_buff.data()), len, flags, &src_addr, &src_addr_len); - - if (ret >= 0 && src_addr_len > 0) { - ctr_src_addr = CTRSockAddr::FromPlatform(src_addr); - std::memcpy(addr_buff.data(), &ctr_src_addr, sizeof(ctr_src_addr)); + if (ret >= 0 && src_addr_len > 0) { + ctr_src_addr = CTRSockAddr::FromPlatform(src_addr); + std::memcpy(addr_buff.data(), &ctr_src_addr, sizeof(ctr_src_addr)); + } } else { + ret = ::recvfrom(socket_handle, reinterpret_cast(output_buff.data()), len, flags, + NULL, 0); addr_buff.resize(0); }