mirror of
https://github.com/znc/znc.git
synced 2026-08-09 10:23:14 +02:00
assert that we have a user/network on module calls
exoa found a bug where OnClientDisconnected() was called with m_pUser = NULL when a client disconnected before logging in which blows up further down the road. This stuff should *never* be called with NULL pointers, despite the if which it has. E.g. the above case skipped user modules, but global modules where still called with a NULL pointer which they didn't expect nor handle for OnClientDisconnected(). Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
@@ -62,6 +62,7 @@
|
||||
} while (false)
|
||||
|
||||
#define USERMODULECALL(macFUNC, macUSER, macNETWORK, macCLIENT, macEXITER) \
|
||||
assert(macUSER != NULL); \
|
||||
if (macUSER) { \
|
||||
CModules& UMods = macUSER->GetModules(); \
|
||||
CIRCNetwork* pOldUNetwork = UMods.GetNetwork(); \
|
||||
@@ -78,6 +79,8 @@
|
||||
}
|
||||
|
||||
#define NETWORKMODULECALL(macFUNC, macUSER, macNETWORK, macCLIENT, macEXITER) \
|
||||
assert(macUSER != NULL); \
|
||||
assert(macNETWORK != NULL); \
|
||||
if (macNETWORK) { \
|
||||
CModules& NMods = ((CIRCNetwork*)macNETWORK)->GetModules(); \
|
||||
CClient* pOldNClient = NMods.GetClient(); \
|
||||
|
||||
Reference in New Issue
Block a user