ps3dev / PSL1GHT

A lightweight PS3 SDK
www.psl1ght.com
MIT License
226 stars 64 forks source link

Fix libnet's recvfrom returns empty address #142

Closed TooManySugar closed 11 months ago

TooManySugar commented 11 months ago

I was tinkering around with UDP connections and found out that recvfrom from libnet returned empty address, but not every time.

The issue was in non-initialized length of returning buffer.

Manpage for FreeBSD's recvfrom(3) says: "The fromlen argument is a value-result argument, initialized to the size of the buffer associated with from, and modified on return to indicate the actual size of the address stored there." So field must be initialized, but it ends with garbage value from the stack.

Strangely enough, problem not present then running from RPCS3 on Windows.

zeldin commented 11 months ago

Good catch. Thanks!