-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Conversation
@@ -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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*sceNetErrnoLoc() = ORBIS_NET_EAFNOSUPPORT;
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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;
}
There was a problem hiding this comment.
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
Allows Beyond: Two Souls to go ingame