summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/protocol.h2
-rw-r--r--src/modes.cpp4
-rw-r--r--src/protocol.cpp1
3 files changed, 5 insertions, 2 deletions
diff --git a/include/protocol.h b/include/protocol.h
index 2744dde0d..81ea7b791 100644
--- a/include/protocol.h
+++ b/include/protocol.h
@@ -66,6 +66,8 @@ class CoreExport IRCDProto : public Service
bool RequiresID;
/* The maximum number of modes we are allowed to set with one MODE command */
unsigned MaxModes;
+ /* The maximum number of bytes a line may have */
+ unsigned MaxLine;
/** Sets the server in NOOP mode. If NOOP mode is enabled, no users
* will be able to oper on the server.
diff --git a/src/modes.cpp b/src/modes.cpp
index 41c2ac663..55ce2b506 100644
--- a/src/modes.cpp
+++ b/src/modes.cpp
@@ -274,7 +274,7 @@ static std::list<Anope::string> BuildModeStrings(StackerInfo *info)
for (it = info->AddModes.begin(), it_end = info->AddModes.end(); it != it_end; ++it)
{
- if (++NModes > IRCD->MaxModes)
+ if (++NModes > IRCD->MaxModes || (buf.length() + parambuf.length() > IRCD->MaxLine - 100)) // Leave room for command, channel, etc
{
ret.push_back(buf + parambuf);
buf = "+";
@@ -294,7 +294,7 @@ static std::list<Anope::string> BuildModeStrings(StackerInfo *info)
buf += "-";
for (it = info->DelModes.begin(), it_end = info->DelModes.end(); it != it_end; ++it)
{
- if (++NModes > IRCD->MaxModes)
+ if (++NModes > IRCD->MaxModes || (buf.length() + parambuf.length() > IRCD->MaxLine - 100)) // Leave room for command, channel, etc
{
ret.push_back(buf + parambuf);
buf = "-";
diff --git a/src/protocol.cpp b/src/protocol.cpp
index ba44ea708..dc07ac40d 100644
--- a/src/protocol.cpp
+++ b/src/protocol.cpp
@@ -28,6 +28,7 @@ IRCDProto::IRCDProto(Module *creator, const Anope::string &p) : Service(creator,
CanSVSNick = CanSVSJoin = CanSetVHost = CanSetVIdent = CanSNLine = CanSQLine = CanSQLineChannel
= CanSZLine = CanSVSHold = CanSVSO = CanCertFP = RequiresID = false;
MaxModes = 3;
+ MaxLine = 512;
if (IRCD == NULL)
IRCD = this;