diff options
author | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-02-14 03:45:26 +0000 |
---|---|---|
committer | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-02-14 03:45:26 +0000 |
commit | 0e991f0e72f78fa259d9d7317189f6fcb3552531 (patch) | |
tree | 53451a1af5d635631db146ee6169b8719dba2cd1 | |
parent | 99967932a486a1238eb9c879389c8f389d65c8bf (diff) |
Audited os_session with help from Adam.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2045 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | src/core/os_session.c | 9 |
2 files changed, 4 insertions, 6 deletions
@@ -35,7 +35,6 @@ Legend: src/core/os_quit.c src/core/os_raw.c src/core/os_restart.c - src/core/os_session.c src/modules/cs_appendtopic.c src/modules/cs_enforce.c src/modules/cs_tban.c diff --git a/src/core/os_session.c b/src/core/os_session.c index 764598484..127cf9058 100644 --- a/src/core/os_session.c +++ b/src/core/os_session.c @@ -211,12 +211,12 @@ class CommandOSException : public Command limitstr = params.size() > last_param - 1 ? params[last_param - 1].c_str() : NULL; - if (params.size() < last_param) + if (params.size() <= last_param) { this->OnSyntaxError(u); return MOD_CONT; } - snprintf(reason, sizeof(reason), "%s%s%s", params[last_param].c_str(), last_param == 3 ? " " : "", last_param == 3 ? params[4].c_str() : ""); + snprintf(reason, sizeof(reason), "%s%s%s", params[last_param].c_str(), last_param == 3 && params.size() > 4 ? " " : "", last_param == 3 && params.size() > 4 ? params[4].c_str() : ""); if (!*reason) { @@ -235,7 +235,7 @@ class CommandOSException : public Command int limit = limitstr && isdigit(*limitstr) ? atoi(limitstr) : -1; - if (limit < 0 || limit > MaxSessionLimit) + if (limit < 0 || limit > static_cast<int>(MaxSessionLimit)) { notice_lang(s_OperServ, u, OPER_EXCEPTION_INVALID_LIMIT, MaxSessionLimit); return MOD_CONT; @@ -399,8 +399,7 @@ class CommandOSException : public Command const char *mask = params.size() > 1 ? params[1].c_str() : NULL; if (mask && strspn(mask, "1234567890,-") == strlen(mask)) - process_numlist(mask, NULL, exception_view_callback, u, - &sent_header); + process_numlist(mask, NULL, exception_view_callback, u, &sent_header); else { for (i = 0; i < nexceptions; ++i) |