mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-09 23:23:14 +02:00
- Make the accept code check if the fd is within bounds instead of relying
on OpenFiles to be correct. This fixes a crash when f.e. 3rd party modules have files open but don't increase OpenFiles. Might also fix a curl crash, though nobody ever reported one.
This commit is contained in:
@@ -2361,3 +2361,7 @@
|
||||
- Get rid of networks/ directory, and all references to it. Suggested by
|
||||
katsklaw and others (#4056).
|
||||
- Added doc/example.es.conf, translated by Severus_Snape.
|
||||
- Make the accept code check if the fd is within bounds instead of relying
|
||||
on OpenFiles to be correct. This fixes a crash when f.e. 3rd party modules
|
||||
have files open but don't increase OpenFiles. Might also fix a curl crash,
|
||||
though nobody ever reported one.
|
||||
|
||||
+12
-1
@@ -1775,7 +1775,18 @@ int read_message(time_t delay, fdlist *listp)
|
||||
break;
|
||||
}
|
||||
ircstp->is_ac++;
|
||||
if (++OpenFiles >= MAXCLIENTS)
|
||||
/* We now check:
|
||||
* 1) The number of open files, which is the limit imposed by the
|
||||
* user during ./Config (MAXCONNECTIONS minus a few).
|
||||
* 2) If the fd number exceeds FD_SETSIZE, which is not
|
||||
* permitted as otherwise FD_SET() and FD_CLR() will fail
|
||||
* in read_message()
|
||||
* Note that the value of FD_SETSIZE may be (much) higher than
|
||||
* MAXCLIENTS/MAXCONNECTIONS. They are not necessarily the same!
|
||||
* Check #2 can be removed if poll() is used.
|
||||
* FIXME: Figure out why I need a FD_SETSIZE-4 here? still have crashes with -1...
|
||||
*/
|
||||
if ((++OpenFiles >= MAXCLIENTS) || (fd > FD_SETSIZE-4))
|
||||
{
|
||||
ircstp->is_ref++;
|
||||
if (last_allinuse < TStime() - 15)
|
||||
|
||||
Reference in New Issue
Block a user