mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-12 20:19:02 -04:00
Extra sanity checks to openssl module events to check for out of range file descriptors
git-svn-id: http://svn.inspircd.org/repository/branches/1_1_stable@8156 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
2a56a80c3d
commit
605924e3ea
@ -191,7 +191,7 @@ int CullList::Apply()
|
||||
ServerInstance->local_users.erase(x);
|
||||
}
|
||||
ServerInstance->clientlist->erase(iter);
|
||||
DELETE(a->GetUser());
|
||||
delete a->GetUser();
|
||||
}
|
||||
|
||||
list.erase(list.begin());
|
||||
|
@ -348,6 +348,10 @@ class ModuleSSLGnuTLS : public Module
|
||||
|
||||
virtual void OnRawSocketAccept(int fd, const std::string &ip, int localport)
|
||||
{
|
||||
/* Are there any possibilities of an out of range fd? Hope not, but lets be paranoid */
|
||||
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
|
||||
return;
|
||||
|
||||
issl_session* session = &sessions[fd];
|
||||
|
||||
session->fd = fd;
|
||||
@ -377,6 +381,10 @@ class ModuleSSLGnuTLS : public Module
|
||||
|
||||
virtual void OnRawSocketConnect(int fd)
|
||||
{
|
||||
/* Are there any possibilities of an out of range fd? Hope not, but lets be paranoid */
|
||||
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
|
||||
return;
|
||||
|
||||
issl_session* session = &sessions[fd];
|
||||
|
||||
session->fd = fd;
|
||||
@ -395,6 +403,10 @@ class ModuleSSLGnuTLS : public Module
|
||||
|
||||
virtual void OnRawSocketClose(int fd)
|
||||
{
|
||||
/* Are there any possibilities of an out of range fd? Hope not, but lets be paranoid */
|
||||
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
|
||||
return;
|
||||
|
||||
CloseSession(&sessions[fd]);
|
||||
|
||||
EventHandler* user = ServerInstance->SE->GetRef(fd);
|
||||
@ -410,6 +422,10 @@ class ModuleSSLGnuTLS : public Module
|
||||
|
||||
virtual int OnRawSocketRead(int fd, char* buffer, unsigned int count, int &readresult)
|
||||
{
|
||||
/* Are there any possibilities of an out of range fd? Hope not, but lets be paranoid */
|
||||
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
|
||||
return 0;
|
||||
|
||||
issl_session* session = &sessions[fd];
|
||||
|
||||
if (!session->sess)
|
||||
@ -501,6 +517,10 @@ class ModuleSSLGnuTLS : public Module
|
||||
|
||||
virtual int OnRawSocketWrite(int fd, const char* buffer, int count)
|
||||
{
|
||||
/* Are there any possibilities of an out of range fd? Hope not, but lets be paranoid */
|
||||
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
|
||||
return 0;
|
||||
|
||||
issl_session* session = &sessions[fd];
|
||||
const char* sendbuffer = buffer;
|
||||
|
||||
|
@ -397,6 +397,10 @@ class ModuleSSLOpenSSL : public Module
|
||||
|
||||
virtual void OnRawSocketAccept(int fd, const std::string &ip, int localport)
|
||||
{
|
||||
/* Are there any possibilities of an out of range fd? Hope not, but lets be paranoid */
|
||||
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
|
||||
return;
|
||||
|
||||
issl_session* session = &sessions[fd];
|
||||
|
||||
session->fd = fd;
|
||||
@ -420,6 +424,10 @@ class ModuleSSLOpenSSL : public Module
|
||||
|
||||
virtual void OnRawSocketConnect(int fd)
|
||||
{
|
||||
/* Are there any possibilities of an out of range fd? Hope not, but lets be paranoid */
|
||||
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
|
||||
return;
|
||||
|
||||
issl_session* session = &sessions[fd];
|
||||
|
||||
session->fd = fd;
|
||||
@ -443,6 +451,10 @@ class ModuleSSLOpenSSL : public Module
|
||||
|
||||
virtual void OnRawSocketClose(int fd)
|
||||
{
|
||||
/* Are there any possibilities of an out of range fd? Hope not, but lets be paranoid */
|
||||
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
|
||||
return;
|
||||
|
||||
CloseSession(&sessions[fd]);
|
||||
|
||||
EventHandler* user = ServerInstance->SE->GetRef(fd);
|
||||
@ -458,6 +470,10 @@ class ModuleSSLOpenSSL : public Module
|
||||
|
||||
virtual int OnRawSocketRead(int fd, char* buffer, unsigned int count, int &readresult)
|
||||
{
|
||||
/* Are there any possibilities of an out of range fd? Hope not, but lets be paranoid */
|
||||
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
|
||||
return 0;
|
||||
|
||||
issl_session* session = &sessions[fd];
|
||||
|
||||
if (!session->sess)
|
||||
@ -535,6 +551,10 @@ class ModuleSSLOpenSSL : public Module
|
||||
|
||||
virtual int OnRawSocketWrite(int fd, const char* buffer, int count)
|
||||
{
|
||||
/* Are there any possibilities of an out of range fd? Hope not, but lets be paranoid */
|
||||
if ((fd < 0) || (fd > MAX_DESCRIPTORS))
|
||||
return 0;
|
||||
|
||||
issl_session* session = &sessions[fd];
|
||||
|
||||
if (!session->sess)
|
||||
|
Loading…
x
Reference in New Issue
Block a user