diff options
-rw-r--r-- | Changes | 1 | ||||
-rw-r--r-- | src/channels.c | 35 | ||||
-rw-r--r-- | version.log | 8 |
3 files changed, 38 insertions, 6 deletions
@@ -30,6 +30,7 @@ Provided by Anope Dev. <dev@anope.org> - 2006 03/01 F Fixed memleaks in hs_set.c. [#441] 04/01 F Fixed missing TS6 functionality in channels.c. [#418] 04/01 F Fixed possible overflow in process(). [#445] +04/01 F Fixed memleak in do_cmode(). [#430] Provided by nenolod. <nenolod@nenolod.net> - 2006 02/03 A Support for Charybdis IRCd. [ #00] diff --git a/src/channels.c b/src/channels.c index 5ed5758c8..8191eccd3 100644 --- a/src/channels.c +++ b/src/channels.c @@ -1101,7 +1101,7 @@ void do_cmode(const char *source, int ac, char **av) { Channel *chan; ChannelInfo *ci = NULL; - int i; + int i, tofree0 = 0, tofree1 = 0, tofree2 = 0; char *t; if (ircdcap->tsmode) { @@ -1133,9 +1133,24 @@ void do_cmode(const char *source, int ac, char **av) if (debug) { alog("debug: Before TS6 swap: do_cmode() chan %s : mode %s : extra %s", av[1], av[2], av[3]); } - av[0] = (ac >= 2 ? sstrdup(av[1]) : NULL); - av[1] = (ac >= 3 ? sstrdup(av[2]) : NULL); - av[2] = (ac >= 4 ? sstrdup(av[3]) : NULL); + if (ac >= 2) { + av[0] = sstrdup(av[1]); + tofree0 = 1; + } else { + av[0] = NULL; + } + if (ac >= 3) { + av[1] = sstrdup(av[2]); + tofree1 = 1; + } else { + av[1] = NULL; + } + if (ac >= 4) { + av[2] = sstrdup(av[3]); + tofree2 = 1; + } else { + av[2] = NULL; + } if (debug) { alog("debug: After TS swap: do_cmode() chan %s : mode %s : extra %s", av[0], av[1], av[2]); } @@ -1154,6 +1169,12 @@ void do_cmode(const char *source, int ac, char **av) alog("debug: MODE %s for nonexistent channel %s", merge_args(ac - 1, av + 1), av[0]); } + if (tofree0) + free(av[0]; + if (tofree1) + free(av[1]; + if (tofree2) + free(av[2]; return; } @@ -1169,6 +1190,12 @@ void do_cmode(const char *source, int ac, char **av) ac--; av++; chan_set_modes(source, chan, ac, av, 1); + if (tofree1) + free(av[0]; + if (tofree2) + free(av[1]; + if (tofree3) + free(av[2]; } /*************************************************************************/ diff --git a/version.log b/version.log index 6f5d60078..d2b730b98 100644 --- a/version.log +++ b/version.log @@ -9,13 +9,17 @@ VERSION_MAJOR="1" VERSION_MINOR="7" VERSION_PATCH="13" VERSION_EXTRA="-svn" -VERSION_BUILD="998" +VERSION_BUILD="999" # $Log$ # +# BUILD : 1.7.13 (999) +# BUGS : 430 +# NOTES : Fixed memleak in do_cmode() +# # BUILD : 1.7.13 (998) # BUGS : 445 -# NOTES : Tixed possible overflow in process() +# NOTES : Fixed possible overflow in process() # # BUILD : 1.7.13 (997) # BUGS : 418 |