From 08c9a7c184d736f9f766d80b98ac696632c7d6d3 Mon Sep 17 00:00:00 2001 From: Inviuz Date: Sat, 25 Mar 2017 11:20:55 +0100 Subject: [PATCH] Check for invalid arguments Caused crash when recvfrom was using null buffer --- rpcs3/Emu/Cell/Modules/sys_net.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rpcs3/Emu/Cell/Modules/sys_net.cpp b/rpcs3/Emu/Cell/Modules/sys_net.cpp index 93ad21d57e..9400683f8b 100644 --- a/rpcs3/Emu/Cell/Modules/sys_net.cpp +++ b/rpcs3/Emu/Cell/Modules/sys_net.cpp @@ -444,6 +444,12 @@ namespace sys_net memcpy(&_addr, addr.get_ptr(), sizeof(::sockaddr)); _addr.sa_family = addr->sa_family; + if (!sock || !buf || len == 0) + { + libnet.error("recvfrom(): invalid arguments buf= *0x%x, len=%d", buf, len); + return SYS_NET_EINVAL; + } + if (s < 0) { libnet.error("recvfrom(): invalid socket %d", s); return SYS_NET_EBADF;