From 3066887ff4cf9f89e626047d0f142ad231053cf1 Mon Sep 17 00:00:00 2001 From: GasInfinity Date: Sat, 28 Mar 2026 17:32:41 +0100 Subject: [PATCH] fix: don't crash when getaddrinfo gets a small or empty buffer in `soc:U` * those are valid in hw! --- src/core/hle/service/soc/soc_u.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/hle/service/soc/soc_u.cpp b/src/core/hle/service/soc/soc_u.cpp index ecce206c7..8971a19a5 100644 --- a/src/core/hle/service/soc/soc_u.cpp +++ b/src/core/hle/service/soc/soc_u.cpp @@ -2078,7 +2078,7 @@ void SOC_U::GetAddrInfoImpl(Kernel::HLERequestContext& ctx) { std::size_t pos = 0; addrinfo* cur = out; while (cur != nullptr) { - if (pos <= out_size - sizeof(CTRAddrInfo)) { + if (sizeof(CTRAddrInfo) <= out_size - pos) { // According to 3dbrew, this function fills whatever it can and does not error even // if the buffer is not big enough. However the count returned is always correct. CTRAddrInfo ctr_addr = CTRAddrInfo::FromPlatform(*cur);