diff options
| author | Sepalani <sepalani@hotmail.fr> | 2015-06-02 13:51:19 +0200 |
|---|---|---|
| committer | Sepalani <sepalani@hotmail.fr> | 2015-06-02 13:51:19 +0200 |
| commit | 893ef208404e0b30aeb8515f0dc984e2774b00a2 (patch) | |
| tree | da6d596c72b49e54030aab60d8ae2e586716a09a /Source | |
| parent | 0463f6149988d49b756c516c0b25d17e3f32137f (diff) | |
Fixed: NULL remotehost in IOCTL_SO_INETATON
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net.cpp | 20 |
1 files changed, 15 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 d94afd8d10..269f96fd2a 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 @@ -921,11 +921,21 @@ 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) + { + INFO_LOG(WII_IPC_NET, "IOCTL_SO_INETATON = %d " + "%s, BufferIn: (%08x, %i), BufferOut: (%08x, %i), IP Found: NULL", -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 = %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; + } break; } |
