Skip to content

Commit

Permalink
Fixes for 1.14
Browse files Browse the repository at this point in the history
Fix heap-use-after-free

requires eggheads/eggdrop#1610)
  • Loading branch information
michaelortmann committed Jun 11, 2024
1 parent 18ac8e3 commit ec6932b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
6 changes: 5 additions & 1 deletion UPDATES
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions core/templates_stats_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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, "+");
Expand Down
10 changes: 8 additions & 2 deletions stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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)))
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit ec6932b

Please sign in to comment.