forked from wolfSSL/wolfssl
Sanity check sockfd
This commit is contained in:
@ -800,6 +800,11 @@ int wolfIO_Send(SOCKET_T sd, char *buf, int sz, int wrFlags)
|
|||||||
nfds = (int)sockfd + 1;
|
nfds = (int)sockfd + 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if ((sockfd < 0) || (sockfd >= FD_SETSIZE)) {
|
||||||
|
WOLFSSL_MSG("socket fd out of FDSET range");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
FD_ZERO(&rfds);
|
FD_ZERO(&rfds);
|
||||||
FD_SET(sockfd, &rfds);
|
FD_SET(sockfd, &rfds);
|
||||||
wfds = rfds;
|
wfds = rfds;
|
||||||
|
Reference in New Issue
Block a user