Fix off-by-one error in the check for s against FD_SETSIZE in add_socketread()
and set_socketwrite(). This was found by Coverity. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@237 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
[Changes 1.2c01]
|
||||
|
||||
* Fix off-by-one error in add_socketread() and set_socketwrite() found
|
||||
by Coverity. (caf)
|
||||
|
||||
* Fix longstanding bug with ordering of rfc1459[] array. (caf)
|
||||
|
||||
* Fix crash after /SETAR -, reported by riderplus. (caf)
|
||||
|
||||
@@ -3513,7 +3513,7 @@ int BX_add_socketread(int s, int port, unsigned long flags, char *server, void (
|
||||
FD_ZERO(&rd);
|
||||
set_socket_read(&rd, &rd);
|
||||
}
|
||||
if (s > FD_SETSIZE)
|
||||
if (s >= FD_SETSIZE)
|
||||
return -1;
|
||||
if (s > sock_manager.max_fd)
|
||||
sock_manager.max_fd = s;
|
||||
@@ -3531,7 +3531,7 @@ int BX_add_socketread(int s, int port, unsigned long flags, char *server, void (
|
||||
|
||||
int BX_set_socketwrite(int s)
|
||||
{
|
||||
if (s > FD_SETSIZE)
|
||||
if (s >= FD_SETSIZE)
|
||||
return -1;
|
||||
if (s > sock_manager.max_fd)
|
||||
sock_manager.max_fd = s;
|
||||
|
||||
Reference in New Issue
Block a user