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:
psychon
2010-03-10 20:47:48 +00:00
parent 5ff69d8e05
commit 547b603488
2 changed files with 7 additions and 2 deletions

View File

@@ -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();