mirror of
https://github.com/znc/znc.git
synced 2026-08-05 16:33:46 +02:00
Fix a possible crash if users are deleted
If a user is deleted while it is trying to connect to an IRC server, the IRC socket wasn't deleted together with the user. At some later point in time, the IRC socket will try to use the user object, which was already freed by now. Fix this by erasing IRC sockets together with their user object. Thanks to cnu for reporting this. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1557 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -193,7 +193,9 @@ bool CZNC::HandleUserDeletion()
|
||||
#endif
|
||||
m_msUsers.erase(pUser->GetUserName());
|
||||
|
||||
CIRCSock* pIRCSock = pUser->GetIRCSock();
|
||||
// Don't use pUser->GetIRCSock(), as that only returns something if the
|
||||
// CIRCSock is already connected, not when it's still connecting!
|
||||
CIRCSock* pIRCSock = (CIRCSock*) m_Manager.FindSockByName("IRC::" + pUser->GetUserName());
|
||||
|
||||
if (pIRCSock) {
|
||||
m_Manager.DelSockByAddr(pIRCSock);
|
||||
|
||||
Reference in New Issue
Block a user