ソースを参照

Disallow netative limit.

Fixes #96
Bryan Drewery 10 年 前
コミット
95f05647b6
2 ファイル変更8 行追加1 行削除
  1. 1 0
      doc/UPDATES.md
  2. 7 1
      src/mod/channels.mod/chanmisc.cc

+ 1 - 0
doc/UPDATES.md

@@ -18,6 +18,7 @@
     was relinked.
   * Raise netsplit timeout to 1000 seconds.
   * Indent BOTNET entries some in .whois.
+  * Disallow negative 'chanset limit' (#96).
 
 # 1.4.6
   * Disable demo TCL support by default to prevent confusion during build.

+ 7 - 1
src/mod/channels.mod/chanmisc.cc

@@ -385,7 +385,13 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item,
           strlcpy(result, "channel limit needs argument", RESULT_LEN);
         return ERROR;
       }
-      if (chan->limitraise && !atoi(item[i]) && dolimit(chan)) //limitraise was disabled by the user
+      int limitraise = atoi(item[i]);
+      if (limitraise < 0) {
+        if (result)
+          strlcpy(result, "channel limit must be a positive number", RESULT_LEN);
+        return ERROR;
+      }
+      if (chan->limitraise && limitraise == 0 && dolimit(chan)) //limitraise was disabled by the user
         add_mode(chan, '-', 'l', "");
       chan->limitraise = atoi(item[i]);
       chan->limit_prot = 0;