diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-07-20 08:53:56 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-07-20 08:53:56 +0000 |
commit | ca781714c1651a9e7042eb930c6b117449f8e1fc (patch) | |
tree | 626d56d3997cfffcfaecf8461ed6cfceed74b200 /src/modules | |
parent | 2d4a319d961e3f9e6aa9f7926f9ed320d72de8da (diff) |
Fixes to some stuff that writes on memory it shouldn't (thanks psychon).
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10047 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_blockcaps.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_chghost.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_conn_umodes.cpp | 3 | ||||
-rw-r--r-- | src/modules/m_dnsbl.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_ripemd160.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_sethost.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/override_map.cpp | 4 |
7 files changed, 10 insertions, 9 deletions
diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index 23658a9fa..31542befd 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -107,7 +107,7 @@ public: std::string hmap = Conf.ReadValue("blockcaps", "capsmap", 0); if (hmap.empty()) hmap = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - memset(&capsmap, 0, 255); + memset(capsmap, 0, sizeof(capsmap)); for (std::string::iterator n = hmap.begin(); n != hmap.end(); n++) capsmap[(unsigned char)*n] = 1; if (percent < 1 || percent > 100) diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index b1d9ade7c..ad5a9b562 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -103,7 +103,7 @@ class ModuleChgHost : public Module if (hmap.empty()) hmap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_/0123456789"; - memset(&hostmap, 0, 255); + memset(hostmap, 0, sizeof(hostmap)); for (std::string::iterator n = hmap.begin(); n != hmap.end(); n++) hostmap[(unsigned char)*n] = 1; } diff --git a/src/modules/m_conn_umodes.cpp b/src/modules/m_conn_umodes.cpp index 42c0ec660..2489f2a1f 100644 --- a/src/modules/m_conn_umodes.cpp +++ b/src/modules/m_conn_umodes.cpp @@ -56,7 +56,8 @@ class ModuleModesOnConnect : public Module // Backup and zero out the disabled usermodes, so that we can override them here. char save[64]; - memcpy(save, ServerInstance->Config->DisabledUModes, 64); + memcpy(save, ServerInstance->Config->DisabledUModes, + sizeof(ServerInstance->Config->DisabledUModes)); memset(ServerInstance->Config->DisabledUModes, 0, 64); for (int j = 0; j < Conf->Enumerate("connect"); j++) diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 3b68e1c94..c4ab5a7e4 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -247,7 +247,7 @@ class ModuleDNSBL : public Module } else { - memset(e->records, 0, 256); + memset(e->records, 0, sizeof(e->records)); e->type = DNSBLConfEntry::A_RECORD; irc::portparser portrange(MyConf->ReadValue("dnsbl", "records", i), false); long item = -1; diff --git a/src/modules/m_ripemd160.cpp b/src/modules/m_ripemd160.cpp index 007a89f09..ab5b23ad1 100644 --- a/src/modules/m_ripemd160.cpp +++ b/src/modules/m_ripemd160.cpp @@ -379,7 +379,7 @@ class ModuleRIPEMD160 : public Module unsigned int i; /* counter */ dword X[16]; /* message words */ - memset(X, 0, 16*sizeof(dword)); + memset(X, 0, sizeof(X)); /* put bytes from strptr into X */ for (i=0; i<(lswlen&63); i++) { @@ -393,7 +393,7 @@ class ModuleRIPEMD160 : public Module if ((lswlen & 63) > 55) { /* length goes to next block */ compress(MDbuf, X); - memset(X, 0, 16*sizeof(dword)); + memset(X, 0, sizeof(X)); } /* append length in bits*/ diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index b84f11acf..fbc71ff2f 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -86,7 +86,7 @@ class ModuleSetHost : public Module if (hmap.empty()) hmap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-_/0123456789"; - memset(&hostmap, 0, 255); + memset(hostmap, 0, sizeof(hostmap)); for (std::string::iterator n = hmap.begin(); n != hmap.end(); n++) hostmap[(unsigned char)*n] = 1; } diff --git a/src/modules/m_spanningtree/override_map.cpp b/src/modules/m_spanningtree/override_map.cpp index b17e266b2..fca32b85b 100644 --- a/src/modules/m_spanningtree/override_map.cpp +++ b/src/modules/m_spanningtree/override_map.cpp @@ -43,7 +43,7 @@ void ModuleSpanningTree::ShowMap(TreeServer* Current, User* user, int depth, cha // For Aligning, we need to work out exactly how deep this thing is, and produce // a 'Spacer' String to compensate. char spacer[40]; - memset(spacer,' ',40); + memset(spacer,' ',sizeof(spacer)); if ((40 - Current->GetName().length() - depth) > 1) { spacer[40 - Current->GetName().length() - depth] = '\0'; } @@ -55,7 +55,7 @@ void ModuleSpanningTree::ShowMap(TreeServer* Current, User* user, int depth, cha float percent; char text[128]; /* Neat and tidy default values, as we're dealing with a matrix not a simple string */ - memset(text, 0, 128); + memset(text, 0, sizeof(text)); if (ServerInstance->Users->clientlist->size() == 0) { |