fix: don't crash when getaddrinfo gets a small or empty buffer in soc:U

* those are valid in hw!
This commit is contained in:
GasInfinity 2026-03-28 17:32:41 +01:00
parent 6db0ebf5b4
commit f07b55cf62
No known key found for this signature in database

View file

@ -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);