diff options
author | Peter Powell <petpow@saberuk.com> | 2013-05-17 01:35:04 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2013-06-06 01:06:47 +0100 |
commit | cc79342f50ce345657fca16c90f1d37a9228d8ad (patch) | |
tree | 0a283f12a2e4eae07e7c0f43a1f254d59cad98e0 | |
parent | 047e29179766076146e7bd6126a883f4f3c95150 (diff) |
Compare to ServerLimits::MaxLine instead of MAXBUF.
-rw-r--r-- | src/modules/extra/m_ldapauth.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_alias.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_blockcaps.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/utils.cpp | 2 | ||||
-rw-r--r-- | src/users.cpp | 6 |
5 files changed, 7 insertions, 7 deletions
diff --git a/src/modules/extra/m_ldapauth.cpp b/src/modules/extra/m_ldapauth.cpp index ebfefd02b..0a0698fc2 100644 --- a/src/modules/extra/m_ldapauth.cpp +++ b/src/modules/extra/m_ldapauth.cpp @@ -212,7 +212,7 @@ public: 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]; diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 7e15b8c04..7343dd21b 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -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; - result.reserve(ServerInstance->Config->Limits.MaxLine); + result.reserve(newline.length()); for (unsigned int i = 0; i < newline.length(); i++) { char c = newline[i]; diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index 0e1fa945f..c13549db8 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -119,7 +119,7 @@ public: 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; diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 47c5ad6e1..c469f41a2 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -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; - FullLine.reserve(ServerInstance->Config->Limits.MaxLine); + FullLine.reserve(1024); FullLine = ":" + prefix + " " + command; for (parameterlist::const_iterator x = params.begin(); x != params.end(); ++x) { diff --git a/src/users.cpp b/src/users.cpp index 656d260e1..cd458f68e 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -443,7 +443,7 @@ void UserIOHandler::OnDataReady() 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 @@ -995,10 +995,10 @@ void LocalUser::Write(const std::string& text) 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. - 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; } |