mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Fix a crash bug if c-ares is enabled
CSocket sometimes calls our select() wrapper with writeds == NULL and we didn't handle this case at all which lead to a NULL pointer dereference. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1586 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -64,6 +64,14 @@ CSockManager::~CSockManager() {
|
||||
int CSockManager::Select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
|
||||
{
|
||||
int ret;
|
||||
fd_set tmp;
|
||||
|
||||
// Csocket sometimes can use NULL for exceptfds and c-ares doesn't like NULLs
|
||||
if (writefds == NULL)
|
||||
{
|
||||
writefds = &tmp;
|
||||
FD_ZERO(writefds);
|
||||
}
|
||||
|
||||
// We assume that nfds is already the max. number of sockets allowed by
|
||||
// the OS, so we don't need to update it here.
|
||||
|
||||
Reference in New Issue
Block a user