فهرست منبع

bin/ircd: restrict irc messages to have a maximum length of 512 characters

ghassmo 4 سال پیش
والد
کامیت
43fb491702
1فایلهای تغییر یافته به همراه5 افزوده شده و 1 حذف شده
  1. 5 1
      bin/ircd/src/server.rs

+ 5 - 1
bin/ircd/src/server.rs

@@ -68,7 +68,11 @@ impl IrcServerConnection {
         }
     }
 
-    pub async fn update(&mut self, line: String) -> Result<()> {
+    async fn update(&mut self, line: String) -> Result<()> {
+        if line.len() > 513 {
+            return Err(Error::MalformedPacket)
+        }
+
         let mut tokens = line.split_ascii_whitespace();
         // Commands can begin with :garbage but we will reject clients doing
         // that for now to keep the protocol simple and focused.