From 0e991f0e72f78fa259d9d7317189f6fcb3552531 Mon Sep 17 00:00:00 2001 From: cyberbotx Date: Sat, 14 Feb 2009 03:45:26 +0000 Subject: Audited os_session with help from Adam. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2045 5417fbe8-f217-4b02-8779-1006273d7864 --- src/core/os_session.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src') 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(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) -- cgit