Skip to content

Commit

Permalink
Fix FD_SET on INVALID_SOCKET in CSock::dataAvailable, undefined behav…
Browse files Browse the repository at this point in the history
…iour
  • Loading branch information
kaetemi committed Mar 3, 2023
1 parent 406ddb4 commit 0b0df0f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nel/src/net/sock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,9 @@ void CSock::connect(const CInetHost &addrs)
*/
bool CSock::dataAvailable()
{
if (_Sock == INVALID_SOCKET)
throw ESocket("CSock::dataAvailable(): invalid socket");

fd_set fdset;
FD_ZERO( &fdset );
FD_SET( _Sock, &fdset );
Expand Down

0 comments on commit 0b0df0f

Please sign in to comment.