libkernel: bind/connect/sendto accept a socket address of any length #8153
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-20T00:48:03Z.
Repro
Guest calls on Windows:
connect(s, addr, 1),bind(s, addr, 0),bind(s, addr, 15)for AF_INET,connect(s6, addr, 20)for AF_INET6,sendto(..., addr, 8),bind(s, addr, 256).Expected (FreeBSD 11.4
getsockaddr, sys/kern/uipc_syscalls.c:1777-1780): length > 255 -> ENAMETOOLONG (63); length < offsetof(struct sockaddr, sa_data) -> EINVAL (22); plus the family check of the protocol (tcp_usr_connect/in_pcbconnect): AF_INET shorter than 16 or AF_INET6 shorter than 28 -> EINVAL.Actual:
Address()incore/libs/prx/libkernel/Socket/src/Udp.cppreturns EFAULT (14) for length < 2 and EAFNOSUPPORT (47) for a short AF_INET/AF_INET6 address.Test:
core/libs/tests/GuestSocketAddressLength.cpp(fails with 0xc0000409 before the fix).Fix branch: https://github.com/xXPBSXx/AnyPS5/tree/fix/socket-address-length-v4
AI-assisted (Claude Code).