Merge pull request #2503 from sepalani/master
Fixed: NULL remoteHost in IOCTL_SO_INETATON
This commit is contained in:
commit
f85db7a686
|
@ -933,11 +933,22 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress)
|
||||||
std::string hostname = Memory::GetString(BufferIn);
|
std::string hostname = Memory::GetString(BufferIn);
|
||||||
struct hostent* remoteHost = gethostbyname(hostname.c_str());
|
struct hostent* remoteHost = gethostbyname(hostname.c_str());
|
||||||
|
|
||||||
Memory::Write_U32(Common::swap32(*(u32*)remoteHost->h_addr_list[0]), BufferOut);
|
if (remoteHost == nullptr || remoteHost->h_addr_list == nullptr || remoteHost->h_addr_list[0] == nullptr)
|
||||||
INFO_LOG(WII_IPC_NET, "IOCTL_SO_INETATON = %d "
|
{
|
||||||
"%s, BufferIn: (%08x, %i), BufferOut: (%08x, %i), IP Found: %08X",remoteHost->h_addr_list[0] == nullptr ? -1 : 0,
|
INFO_LOG(WII_IPC_NET, "IOCTL_SO_INETATON = -1 "
|
||||||
hostname.c_str(), BufferIn, BufferInSize, BufferOut, BufferOutSize, Common::swap32(*(u32*)remoteHost->h_addr_list[0]));
|
"%s, BufferIn: (%08x, %i), BufferOut: (%08x, %i), IP Found: None",
|
||||||
ReturnValue = remoteHost->h_addr_list[0] == nullptr ? 0 : 1;
|
hostname.c_str(), BufferIn, BufferInSize, BufferOut, BufferOutSize);
|
||||||
|
ReturnValue = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Memory::Write_U32(Common::swap32(*(u32*)remoteHost->h_addr_list[0]), BufferOut);
|
||||||
|
INFO_LOG(WII_IPC_NET, "IOCTL_SO_INETATON = 0 "
|
||||||
|
"%s, BufferIn: (%08x, %i), BufferOut: (%08x, %i), IP Found: %08X",
|
||||||
|
hostname.c_str(), BufferIn, BufferInSize, BufferOut, BufferOutSize,
|
||||||
|
Common::swap32(*(u32*)remoteHost->h_addr_list[0]));
|
||||||
|
ReturnValue = 1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue