summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoraquanight <aquanight@e03df62e-2008-0410-955e-edbf42e46eb7>2008-03-23 21:36:16 +0000
committeraquanight <aquanight@e03df62e-2008-0410-955e-edbf42e46eb7>2008-03-23 21:36:16 +0000
commitfb958dd6e46c66b54fca57986343c1c7e87d6d62 (patch)
tree113731bd655e6b18f03db2e78b82cb027f045c61 /src
parent8727da59032e9536b565b44b462ce7c88f7169d4 (diff)
Clean up user/chan modes on deoper, fix memsets off-by-1, delete[] properly in destructor
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9182 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/users.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/users.cpp b/src/users.cpp
index ee35c3878..46665396f 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -233,13 +233,13 @@ User::~User()
if (this->AllowedUserModes)
{
- delete AllowedUserModes;
+ delete[] AllowedUserModes;
AllowedUserModes = NULL;
}
if (this->AllowedChanModes)
{
- delete AllowedChanModes;
+ delete[] AllowedChanModes;
AllowedChanModes = NULL;
}
@@ -704,8 +704,8 @@ void User::Oper(const std::string &opertype, const std::string &opername)
if (!AllowedUserModes)
AllowedUserModes = new bool[64];
- memset(AllowedUserModes, 0, 63);
- memset(AllowedChanModes, 0, 63);
+ memset(AllowedUserModes, 0, 64);
+ memset(AllowedChanModes, 0, 64);
char* Classes = strdup(iter_opertype->second);
char* myclass = strtok_r(Classes," ",&savept);
@@ -727,7 +727,7 @@ void User::Oper(const std::string &opertype, const std::string &opername)
{
if (*c == '*')
{
- memset(this->AllowedUserModes, (int)(true), 63);
+ memset(this->AllowedUserModes, (int)(true), 64);
}
else
{
@@ -738,7 +738,7 @@ void User::Oper(const std::string &opertype, const std::string &opername)
{
if (*c == '*')
{
- memset(this->AllowedChanModes, (int)(true), 63);
+ memset(this->AllowedChanModes, (int)(true), 64);
}
else
{
@@ -792,6 +792,17 @@ void User::UnOper()
delete AllowedOperCommands;
AllowedOperCommands = NULL;
}
+ if (AllowedUserModes)
+ {
+ delete[] AllowedUserModes;
+ AllowedUserModes = NULL;
+ }
+ if (AllowedChanModes)
+ {
+ delete[] AllowedChanModes;
+ AllowedChanModes = NULL;
+ }
+
}
}