Skip to content

return nullptr from inet_ntop on error #2999

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

mikusp
Copy link
Contributor

@mikusp mikusp commented May 27, 2025

Allows Beyond: Two Souls to go ingame

@@ -962,7 +962,7 @@ const char* PS4_SYSV_ABI sceNetInetNtop(int af, const void* src, char* dst, u32
const char* res = inet_ntop(af, src, dst, size);
#endif
if (res == nullptr) {
UNREACHABLE();
return nullptr;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error case should also set the errno value in *sceNetErrnoLoc() with one of the ORBIS_NET_E* values.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*sceNetErrnoLoc() = ORBIS_NET_EAFNOSUPPORT;

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a LOG_ERROR would be nice too as well

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*sceNetErrnoLoc() = ORBIS_NET_EAFNOSUPPORT;

In this case it should be based on the inet_ntop error code shouldn’t it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

based on RE that is the only valid sceNetErrno value it can take in case of failure

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@georgemoralis the game calls the function with some bogus values, like af = 223 and af = 249

Copy link
Collaborator

@squidbus squidbus May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to see source it actually matches up to this (except not setting the errno): https://github.com/freebsd/freebsd-src/blob/main/sys/libkern/inet_ntop.c

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@georgemoralis the game calls the function with some bogus values, like af = 223 and af = 249

in that case ORBIS_NET_EAFNOSUPPORT should be fine for it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well i think i should rewrite it to match more the RE . Atm we we want to accept this i think at least ORBIS_NET_EAFNOSUPPORT be added somethink like

if(AF_NET ! = 2 || other valid AF_NET ){
*sceNetErrnoLoc() = ORBIS_NET_EAFNOSUPPORT;
return nullptr;
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and unreachable should left for the other cases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants