diff --git a/Changelog b/Changelog index 87afc93..6bacf4a 100644 --- a/Changelog +++ b/Changelog @@ -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) diff --git a/source/misc.c b/source/misc.c index 81e2a08..5ad8f9a 100644 --- a/source/misc.c +++ b/source/misc.c @@ -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;