Merge pull request #3655 from GregorR/netplay-error-checking

Checks for some netplay syscall errors and NULL deref errors
This commit is contained in:
Twinaphex 2016-09-25 00:58:41 +02:00 committed by GitHub
commit 77036100d4
3 changed files with 16 additions and 12 deletions

View File

@ -829,7 +829,8 @@ static int init_tcp_connection(const struct addrinfo *res,
#if defined(IPPROTO_TCP) && defined(TCP_NODELAY)
{
int flag = 1;
setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (void*)&flag, sizeof(int));
if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (void*)&flag, sizeof(int)) < 0)
RARCH_WARN("Could not set netplay TCP socket to nodelay. Expect jitter.\n");
}
#endif

View File

@ -99,20 +99,22 @@ uint32_t netplay_impl_magic(void)
runloop_ctl(RUNLOOP_CTL_SYSTEM_INFO_GET, &info);
if (info)
lib = info->info.library_name;
res |= api;
len = strlen(lib);
for (i = 0; i < len; i++)
res ^= lib[i] << (i & 0xf);
if (info)
{
lib = info->info.library_name;
lib = info->info.library_version;
len = strlen(lib);
len = strlen(lib);
for (i = 0; i < len; i++)
res ^= lib[i] << (i & 0xf);
for (i = 0; i < len; i++)
res ^= lib[i] << (i & 0xf);
lib = info->info.library_version;
len = strlen(lib);
for (i = 0; i < len; i++)
res ^= lib[i] << (i & 0xf);
}
len = strlen(ver);
for (i = 0; i < len; i++)

View File

@ -115,7 +115,8 @@ static bool netplay_net_pre_frame(netplay_t *netplay)
#if defined(IPPROTO_TCP) && defined(TCP_NODELAY)
{
int flag = 1;
setsockopt(netplay->fd, IPPROTO_TCP, TCP_NODELAY, (void*)&flag, sizeof(int));
if (setsockopt(netplay->fd, IPPROTO_TCP, TCP_NODELAY, (void*)&flag, sizeof(int)) < 0)
RARCH_WARN("Could not set netplay TCP socket to nodelay. Expect jitter.\n");
}
#endif