From b0b6034e634917c7f44e2b563a0c32086084cd89 Mon Sep 17 00:00:00 2001 From: darkf Date: Thu, 24 Apr 2014 05:10:43 -0700 Subject: [PATCH] accept accepts NULL address --- rpcs3/Emu/SysCalls/Modules/sys_net.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/rpcs3/Emu/SysCalls/Modules/sys_net.cpp b/rpcs3/Emu/SysCalls/Modules/sys_net.cpp index 03f2c3ba30..aed1f6045d 100644 --- a/rpcs3/Emu/SysCalls/Modules/sys_net.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sys_net.cpp @@ -90,13 +90,20 @@ using pck_len_t = u32; int sys_net_accept(s32 s, mem_ptr_t addr, mem32_t paddrlen) { sys_net.Warning("accept(s=%d, family_addr=0x%x, paddrlen=0x%x)", s, addr.GetAddr(), paddrlen.GetAddr()); - sockaddr _addr; - memcpy(&_addr, Memory.VirtualToRealAddr(addr.GetAddr()), sizeof(sockaddr)); - _addr.sa_family = addr->sa_family; - pck_len_t *_paddrlen = (pck_len_t *) Memory.VirtualToRealAddr(paddrlen.GetAddr()); - int ret = accept(s, &_addr, _paddrlen); - g_lastError = getLastError(); - return ret; + if (addr.GetAddr() == 0) { + int ret = accept(s, NULL, NULL); + g_lastError = getLastError(); + return ret; + } + else { + sockaddr _addr; + memcpy(&_addr, Memory.VirtualToRealAddr(addr.GetAddr()), sizeof(sockaddr)); + _addr.sa_family = addr->sa_family; + pck_len_t *_paddrlen = (pck_len_t *)Memory.VirtualToRealAddr(paddrlen.GetAddr()); + int ret = accept(s, &_addr, _paddrlen); + g_lastError = getLastError(); + return ret; + } } int sys_net_bind(s32 s, mem_ptr_t family, u32 addrlen)