From feca415c2342bd0339af07e95a1e0811385ec2d3 Mon Sep 17 00:00:00 2001 From: Alexey Sokolov Date: Sun, 20 Oct 2013 22:24:05 +0400 Subject: [PATCH] Fix a random crash with module hooks How to reproduce: 1. have a global module which in a hook does something which calls hooks too, e.g. Broadcast() 2. have another global module loaded after the first one which uses m_pNetwork in that hook 3. enjoy the crash (or just weird behavior if you're unlucky) So, when ZNC is setup with the "proper" global modules and in a special order, one can crash it just from IRC, by triggering the needed module hooks. Affected version: 1.0 Thanks to ChauffeR (Simone Esposito) for reporting the issue and helping to debug it. --- include/znc/main.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/znc/main.h b/include/znc/main.h index 8c02f293..2e47beda 100644 --- a/include/znc/main.h +++ b/include/znc/main.h @@ -71,6 +71,7 @@ extern bool ZNC_NO_NEED_TO_DO_ANYTHING_ON_MODULE_CALL_EXITER; *macEXITER = true; \ } \ GMods.SetUser(pOldGUser); \ + GMods.SetNetwork(pOldGNetwork); \ GMods.SetClient(pOldGClient); \ } while (false)