]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Check that the values specified in <limits> are reasonable.
authorSadie Powell <sadie@witchery.services>
Wed, 30 Sep 2020 16:21:52 +0000 (17:21 +0100)
committerSadie Powell <sadie@witchery.services>
Wed, 30 Sep 2020 16:21:52 +0000 (17:21 +0100)
include/configreader.h
src/configreader.cpp

index d8866e7d9540820d89fb641753f075ee6c62004f..7274dfad851c003be8ed4a99c249ed84134b0830 100644 (file)
@@ -95,6 +95,8 @@ class CoreExport ConfigTag : public refcountbase
 class ServerLimits
 {
  public:
+       /** Maximum line length */
+       size_t MaxLine;
        /** Maximum nickname length */
        size_t NickMax;
        /** Maximum channel length */
@@ -113,8 +115,6 @@ class ServerLimits
        size_t MaxReal;
        /** Maximum away message length */
        size_t MaxAway;
-       /** Maximum line length */
-       size_t MaxLine;
        /** Maximum hostname length */
        size_t MaxHost;
 
index 68630685fd03bd1484822fc89f893d0964537f71..d06753423af9df5b8779fabc2694fcadc01d7f81 100644 (file)
 #include <iostream>
 
 ServerLimits::ServerLimits(ConfigTag* tag)
-       : NickMax(tag->getUInt("maxnick", 30))
-       , ChanMax(tag->getUInt("maxchan", 64))
-       , MaxModes(tag->getUInt("maxmodes", 20))
-       , IdentMax(tag->getUInt("maxident", 10))
-       , MaxQuit(tag->getUInt("maxquit", 255))
-       , MaxTopic(tag->getUInt("maxtopic", 307))
-       , MaxKick(tag->getUInt("maxkick", 255))
-       , MaxReal(tag->getUInt("maxreal", tag->getUInt("maxgecos", 128)))
-       , MaxAway(tag->getUInt("maxaway", 200))
-       , MaxLine(tag->getUInt("maxline", 512))
-       , MaxHost(tag->getUInt("maxhost", 64))
+       : MaxLine(tag->getUInt("maxline", 512, 512))
+       , NickMax(tag->getUInt("maxnick", 30, 1, MaxLine))
+       , ChanMax(tag->getUInt("maxchan", 64, 1, MaxLine))
+       , MaxModes(tag->getUInt("maxmodes", 20, 1))
+       , IdentMax(tag->getUInt("maxident", 10, 1))
+       , MaxQuit(tag->getUInt("maxquit", 255, 0, MaxLine))
+       , MaxTopic(tag->getUInt("maxtopic", 307, 1, MaxLine))
+       , MaxKick(tag->getUInt("maxkick", 255, 1, MaxLine))
+       , MaxReal(tag->getUInt("maxreal", tag->getUInt("maxgecos", 128), 1, MaxLine))
+       , MaxAway(tag->getUInt("maxaway", 200, 1, MaxLine))
+       , MaxHost(tag->getUInt("maxhost", 64, 1, MaxLine))
 {
 }