mirror of
https://git.eden-emu.dev/archive/citron
synced 2026-04-08 12:18:49 -04:00
sockets/network: relax SockAddrIn len check and fix port byte-order to avoid SSBU crashes
- Accept SockAddrIn len in [6, sizeof] and warn instead of asserting to handle libnx/SSBU quirks - Ensure TranslateFromSockAddrIn sets sin_port via htons(uint16_t) for consistent network byte-order - Prevents assertion crashes and reduces “Broken pipe” error spam observed in Frozen's SSBU logs Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
@@ -91,7 +91,8 @@ sockaddr TranslateFromSockAddrIn(SockAddrIn input) {
|
||||
break;
|
||||
}
|
||||
|
||||
result.sin_port = htons(input.portno);
|
||||
// input.portno is already in host byte order in our abstraction. Ensure network order here.
|
||||
result.sin_port = htons(static_cast<uint16_t>(input.portno));
|
||||
|
||||
auto& ip = result.sin_addr.S_un.S_un_b;
|
||||
ip.s_b1 = input.ip[0];
|
||||
|
||||
Reference in New Issue
Block a user