mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-02-16 02:21:07 +00:00
Switch to poll() to be safe against stack corruption from exceeding FD_SETSIZE
Fortunately, the fd_set definition is not prone to stack corruption on Windows, because FD_SETSIZE is the maximum number of sockets in a fd_set, not the maximum value socket file descriptor that can be stored in a fd_set. https://beesbuzz.biz/code/5739-The-problem-with-select-vs-poll
This commit is contained in:
@@ -29,6 +29,7 @@ typedef int SOCKADDR_LEN;
|
||||
#include <netdb.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <poll.h>
|
||||
|
||||
#define ioctlsocket ioctl
|
||||
#define LastSocketError() errno
|
||||
@@ -59,6 +60,7 @@ int setNonFatalRecvTimeoutMs(SOCKET s, int timeoutMs);
|
||||
void setRecvTimeout(SOCKET s, int timeoutSec);
|
||||
void closeSocket(SOCKET s);
|
||||
int isPrivateNetworkAddress(struct sockaddr_storage* address);
|
||||
int pollSockets(struct pollfd* pollFds, int pollFdsCount, int timeoutMs);
|
||||
|
||||
int initializePlatformSockets(void);
|
||||
void cleanupPlatformSockets(void);
|
||||
|
||||
Reference in New Issue
Block a user