mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Fix a crash bug with WebMods and auth modules
When a CWebSock was destroyed before its CWebAuth, the CWebAuth dereferenced a stale pointer once it was used again. Fix this by calling CAuthBase::Invalidate() appropriately. Thanks to DarthGandalf for finding this. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1826 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -96,6 +96,11 @@ void CWebAuth::RefusedLogin(const CString& sReason) {
|
||||
}
|
||||
}
|
||||
|
||||
void CWebAuth::Invalidate() {
|
||||
CAuthBase::Invalidate();
|
||||
m_pWebSock = NULL;
|
||||
}
|
||||
|
||||
CWebSock::CWebSock(CModule* pModule) : CHTTPSock(pModule) {
|
||||
m_pModule = pModule;
|
||||
m_bPathsSet = false;
|
||||
@@ -113,8 +118,7 @@ CWebSock::CWebSock(CModule* pModule, const CString& sHostname, unsigned short uP
|
||||
|
||||
CWebSock::~CWebSock() {
|
||||
if (!m_spAuth.IsNull()) {
|
||||
CWebAuth* pAuth = (CWebAuth*) &(*m_spAuth);
|
||||
pAuth->SetWebSock(NULL);
|
||||
m_spAuth->Invalidate();
|
||||
}
|
||||
|
||||
CUser *pUser = GetSession()->GetUser();
|
||||
|
||||
Reference in New Issue
Block a user