mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
WebModules: Fix a NULL pointer dereference
Commit b1593238d5 started using the module pointer before the NULL
check. This caused crashes whenever someone (even without a login!) accessed a
web page on znc for a module which didn't exist.
Thanks to J0rd4n` for reporting this to us.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
@@ -686,12 +686,13 @@ CWebSock::EPageReqResult CWebSock::OnPageRequestInternal(const CString& sURI, CS
|
||||
break;
|
||||
}
|
||||
|
||||
if (!pModule)
|
||||
return PAGE_NOTFOUND;
|
||||
|
||||
m_Template["ModPath"] = pModule->GetWebPath();
|
||||
m_Template["ModFilesPath"] = pModule->GetWebFilesPath();
|
||||
|
||||
if (!pModule) {
|
||||
return PAGE_NOTFOUND;
|
||||
} else if (pModule->WebRequiresLogin() && !ForceLogin()) {
|
||||
if (pModule->WebRequiresLogin() && !ForceLogin()) {
|
||||
return PAGE_PRINT;
|
||||
} else if (pModule->WebRequiresAdmin() && !GetSession()->IsAdmin()) {
|
||||
PrintErrorPage(403, "Forbidden", "You need to be an admin to access this module");
|
||||
|
||||
Reference in New Issue
Block a user