]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Compare to ServerLimits::MaxLine instead of MAXBUF.
authorPeter Powell <petpow@saberuk.com>
Fri, 17 May 2013 00:35:04 +0000 (01:35 +0100)
committerPeter Powell <petpow@saberuk.com>
Thu, 6 Jun 2013 00:06:47 +0000 (01:06 +0100)
src/modules/extra/m_ldapauth.cpp
src/modules/m_alias.cpp
src/modules/m_blockcaps.cpp
src/modules/m_spanningtree/utils.cpp
src/users.cpp

index ebfefd02be16eb445d85df7c1b4b757cf458e1e2..0a0698fc2946679f67957a2503e2b63b54fbdc3f 100644 (file)
@@ -212,7 +212,7 @@ public:
                        std::string> &replacements)
        {
                std::string result;
                        std::string> &replacements)
        {
                std::string result;
-               result.reserve(ServerInstance->Config->Limits.MaxLine);
+               result.reserve(text.length());
 
                for (unsigned int i = 0; i < text.length(); ++i) {
                        char c = text[i];
 
                for (unsigned int i = 0; i < text.length(); ++i) {
                        char c = text[i];
index 7e15b8c04a52b395abd4e10f226ac499a81762ca..7343dd21ba58d9f907859b4d1216c115a529b5cf 100644 (file)
@@ -309,7 +309,7 @@ class ModuleAlias : public Module
        void DoCommand(const std::string& newline, User* user, Channel *chan, const std::string &original_line)
        {
                std::string result;
        void DoCommand(const std::string& newline, User* user, Channel *chan, const std::string &original_line)
        {
                std::string result;
-               result.reserve(ServerInstance->Config->Limits.MaxLine);
+               result.reserve(newline.length());
                for (unsigned int i = 0; i < newline.length(); i++)
                {
                        char c = newline[i];
                for (unsigned int i = 0; i < newline.length(); i++)
                {
                        char c = newline[i];
index 0e1fa945ffecfdd5ef391d71b6a431d592fc1692..c13549db87c6d2632821c2b08e42b9f6eff4e364 100644 (file)
@@ -119,7 +119,7 @@ public:
                        ServerInstance->Logs->Log("CONFIG", LOG_DEFAULT, "<blockcaps:percent> out of range, setting to default of 100.");
                        percent = 100;
                }
                        ServerInstance->Logs->Log("CONFIG", LOG_DEFAULT, "<blockcaps:percent> out of range, setting to default of 100.");
                        percent = 100;
                }
-               if (minlen < 1 || minlen > MAXBUF-1)
+               if (minlen < 1 || minlen > ServerInstance->Config->Limits.MaxLine)
                {
                        ServerInstance->Logs->Log("CONFIG", LOG_DEFAULT, "<blockcaps:minlen> out of range, setting to default of 1.");
                        minlen = 1;
                {
                        ServerInstance->Logs->Log("CONFIG", LOG_DEFAULT, "<blockcaps:minlen> out of range, setting to default of 1.");
                        minlen = 1;
index 47c5ad6e10ae3142460ebb834a800028dcc03fca..c469f41a29cc17c2e154dd6bb78b38d03d775c41 100644 (file)
@@ -197,7 +197,7 @@ void SpanningTreeUtilities::GetListOfServersForChannel(Channel* c, TreeServerLis
 std::string SpanningTreeUtilities::ConstructLine(const std::string& prefix, const std::string& command, const parameterlist& params)
 {
        std::string FullLine;
 std::string SpanningTreeUtilities::ConstructLine(const std::string& prefix, const std::string& command, const parameterlist& params)
 {
        std::string FullLine;
-       FullLine.reserve(ServerInstance->Config->Limits.MaxLine);
+       FullLine.reserve(1024);
        FullLine = ":" + prefix + " " + command;
        for (parameterlist::const_iterator x = params.begin(); x != params.end(); ++x)
        {
        FullLine = ":" + prefix + " " + command;
        for (parameterlist::const_iterator x = params.begin(); x != params.end(); ++x)
        {
index 656d260e1f45f37516cf05f8fb9f5decca6268bd..cd458f68e1275aea524bc8e2ec83d58114d1dfa6 100644 (file)
@@ -443,7 +443,7 @@ void UserIOHandler::OnDataReady()
                        case '\n':
                                goto eol_found;
                        }
                        case '\n':
                                goto eol_found;
                        }
-                       if (line.length() < MAXBUF - 2)
+                       if (line.length() < ServerInstance->Config->Limits.MaxLine - 2)
                                line.push_back(c);
                }
                // if we got here, the recvq ran out before we found a newline
                                line.push_back(c);
                }
                // if we got here, the recvq ran out before we found a newline
@@ -995,10 +995,10 @@ void LocalUser::Write(const std::string& text)
        if (!ServerInstance->SE->BoundsCheckFd(&eh))
                return;
 
        if (!ServerInstance->SE->BoundsCheckFd(&eh))
                return;
 
-       if (text.length() > MAXBUF - 2)
+       if (text.length() > ServerInstance->Config->Limits.MaxLine - 2)
        {
                // this should happen rarely or never. Crop the string at 512 and try again.
        {
                // this should happen rarely or never. Crop the string at 512 and try again.
-               std::string try_again = text.substr(0, MAXBUF - 2);
+               std::string try_again = text.substr(0, ServerInstance->Config->Limits.MaxLine - 2);
                Write(try_again);
                return;
        }
                Write(try_again);
                return;
        }