Skip to content
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

Fix sys_net_bnet_sendto #8026

Merged
merged 1 commit into from
Apr 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions rpcs3/Emu/Cell/lv2/sys_net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1404,10 +1404,11 @@ error_code sys_net_bnet_sendto(ppu_thread& ppu, s32 s, vm::cptr<void> buf, u32 l
}

// Used by DGRAM_P2P socket
const u16 davport = reinterpret_cast<const sys_net_sockaddr_in_p2p*>(addr.get_ptr())->sin_vport;
u16 davport = 0;

if (addr)
{
davport = reinterpret_cast<const sys_net_sockaddr_in_p2p*>(addr.get_ptr())->sin_vport;
name.sin_family = AF_INET;
name.sin_port = std::bit_cast<u16>(psa_in->sin_port);
name.sin_addr.s_addr = std::bit_cast<u32>(psa_in->sin_addr);
Expand All @@ -1425,7 +1426,7 @@ error_code sys_net_bnet_sendto(ppu_thread& ppu, s32 s, vm::cptr<void> buf, u32 l
const auto sock = idm::check<lv2_socket>(s, [&](lv2_socket& sock)
{
type = sock.type;
if (sock.type == SYS_NET_SOCK_DGRAM_P2P)
if (sock.type == SYS_NET_SOCK_DGRAM_P2P && addr)
{
const u16 daport = std::bit_cast<be_t<u16>, u16>(name.sin_port);
sys_net.error("Sending a P2P packet to %s:%d:%d", name.sin_addr, daport, davport);
Expand Down