diff options
| author | comex <comexk@gmail.com> | 2015-06-02 20:23:39 -0400 |
|---|---|---|
| committer | comex <comexk@gmail.com> | 2015-06-02 20:23:39 -0400 |
| commit | f85db7a6867054dc484fc86047fed0655a5e0458 (patch) | |
| tree | 8b24c38dd89179fe03086478c6290ce29742e45c /Source/Core | |
| parent | c0e567731a97f241d14ea8762ad0e55b27fc294e (diff) | |
| parent | f494d1f2245449b1bd8f9bc5fc3b05e62ddbbaf2 (diff) | |
Merge pull request #2503 from sepalani/master
Fixed: NULL remoteHost in IOCTL_SO_INETATON
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net.cpp b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net.cpp index 69cf92c1ed..be61fa5ec4 100644 --- a/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net.cpp +++ b/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net.cpp @@ -933,11 +933,22 @@ IPCCommandResult CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress) std::string hostname = Memory::GetString(BufferIn); struct hostent* remoteHost = gethostbyname(hostname.c_str()); - Memory::Write_U32(Common::swap32(*(u32*)remoteHost->h_addr_list[0]), BufferOut); - 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, - hostname.c_str(), BufferIn, BufferInSize, BufferOut, BufferOutSize, Common::swap32(*(u32*)remoteHost->h_addr_list[0])); - ReturnValue = remoteHost->h_addr_list[0] == nullptr ? 0 : 1; + if (remoteHost == nullptr || remoteHost->h_addr_list == nullptr || remoteHost->h_addr_list[0] == nullptr) + { + INFO_LOG(WII_IPC_NET, "IOCTL_SO_INETATON = -1 " + "%s, BufferIn: (%08x, %i), BufferOut: (%08x, %i), IP Found: None", + 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; } |
