From 02ff9916b33e2e5d879a1d09989a16dffa6fb6ed Mon Sep 17 00:00:00 2001 From: Michael Ortmann <41313082+michaelortmann@users.noreply.github.com> Date: Tue, 11 Jun 2024 11:04:05 +0200 Subject: [PATCH] Fixes for 1.14 Fix heap-use-after-free requires https://github.com/eggheads/eggdrop/pull/1610) --- README | 4 ++-- UPDATES | 6 +++++- core/templates_stats_commands.c | 4 ++-- stats.c | 10 ++++++++-- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/README b/README index d3479ef..27e5794 100644 --- a/README +++ b/README @@ -24,8 +24,8 @@ Unfortunately, you need to compile stats.mod within your eggdrop source, so if you removed your original compile directory, you'll have to compile the whole bot again... sorry. -Put stats.mod.1.13.tar.gz in ~/eggdrop-1.9.5/src/mod/, -and unpack it (tar xfz stats.mod-1.13.tar.gz). Change directory +Put stats.mod.1.14.tar.gz in ~/eggdrop-1.9.5/src/mod/, +and unpack it (tar xfz stats.mod-1.14.tar.gz). Change directory back to ~/eggdrop-1.9.5/. Type 'make config'. Type 'make', wait until compiling is done and use 'make install' to install the bot and stats.mod. diff --git a/UPDATES b/UPDATES index ffbbef6..9f1238f 100644 --- a/UPDATES +++ b/UPDATES @@ -1,7 +1,11 @@ Changes in Stats.mod: (since v1.0.1) -------------------- +1.14 +- Fix heap-use-after-free + requires https://github.com/eggheads/eggdrop/pull/1610) + 1.13 -- Fixed heap-buffer-overflow +- Fix heap-buffer-overflow 1.12 - Fix restrict diff --git a/core/templates_stats_commands.c b/core/templates_stats_commands.c index b188a5e..87f788b 100644 --- a/core/templates_stats_commands.c +++ b/core/templates_stats_commands.c @@ -984,7 +984,7 @@ static void template_send_onchanlist(int idx, struct template_content *h_tpc) for (m = schan_members_getfirst(&chan->members); m ; m = schan_members_getnext(&chan->members)) { glob_statsmember = m; - glob_user = m->user; /* FIXME: heap-use-after-free - free() in tclchan.c:init_channel() - see https://github.com/eggheads/eggdrop/pull/1550 */ + glob_user = m->user; /* heap-use-after-free - free() in tclchan.c:init_channel() - Fix: https://github.com/eggheads/eggdrop/pull/1610 */ if (m->stats) glob_locstats = m->stats; else @@ -997,7 +997,7 @@ static void template_send_usermode(int idx, struct template_content *h_tpc) { if (glob_statsmember && glob_statsmember->eggmember) { #ifndef NO_EGG - if (chan_hasop(glob_statsmember->eggmember)) /* FIXME: heap-use-after-free - free() in tclchan.c:init_channel() - see https://github.com/eggheads/eggdrop/pull/1550 */ + if (chan_hasop(glob_statsmember->eggmember)) /* heap-use-after-free - free() in tclchan.c:init_channel() - Fix: https://github.com/eggheads/eggdrop/pull/1610 */ dprintf(idx, "@"); if (chan_hasvoice(glob_statsmember->eggmember)) dprintf(idx, "+"); diff --git a/stats.c b/stats.c index 7389a5b..4743064 100644 --- a/stats.c +++ b/stats.c @@ -31,7 +31,7 @@ #define MAKING_STATS #define MODULE_NAME "stats" -#define MODULE_VERSION "1.13" +#define MODULE_VERSION "1.14" #ifndef NO_EGG #include "../module.h" #include "../irc.mod/irc.h" @@ -414,6 +414,9 @@ static char *stats_close() rem_help_reference("stats.help"); del_hook(HOOK_MINUTELY, (Function) stats_minutely); del_hook(HOOK_DAILY, (Function) stats_daily); +#ifdef HOOK_RESET_MEMBER + del_hook(HOOK_RESET_MEMBER, (Function) egg_check_chan_desynch); +#endif module_undepend(MODULE_NAME); #ifndef NO_MEM_DEBUG dmd_unload(); @@ -446,7 +449,7 @@ char *stats_start(Function * global_funcs) chanlangs = NULL; slang_glob_init(); - module_register(MODULE_NAME, stats_table, 1, 13); + module_register(MODULE_NAME, stats_table, 1, 14); if (!(irc_funcs = module_depend(MODULE_NAME, "irc", 1, 0))) return "You need the irc module to use the stats module."; if (!(server_funcs = module_depend(MODULE_NAME, "server", 1, 0))) @@ -481,6 +484,9 @@ char *stats_start(Function * global_funcs) add_tcl_commands(mytcls); add_hook(HOOK_MINUTELY, (Function) stats_minutely); add_hook(HOOK_DAILY, (Function) stats_daily); +#ifdef HOOK_RESET_MEMBER + add_hook(HOOK_RESET_MEMBER, (Function) egg_check_chan_desynch); +#endif add_help_reference("stats.help"); lastmonth = getmonth(); read_stats();