Don't allow too big messages from clients
authorunc0rr
Thu, 23 Jul 2015 19:51:14 +0300
changeset 11027 ba585693e19d
parent 11026 b8022f4bea14
child 11028 37977c3994e6
Don't allow too big messages from clients
gameServer/ClientIO.hs
--- a/gameServer/ClientIO.hs	Tue Jul 21 23:51:58 2015 +0300
+++ b/gameServer/ClientIO.hs	Thu Jul 23 19:51:14 2015 +0300
@@ -55,6 +55,7 @@
             unless (B.null recvBS) $ do
                 let (packets, newrecvBuf) = bs2Packets $ B.append recvBuf recvBS
                 forM_ packets sendPacket
+                when (B.length newrecvBuf > 128 * 1024) $ sendPacket ["QUIT", "Protocol violation"]
                 receiveWithBufferLoop $ B.copy newrecvBuf
 
         sendPacket packet = writeChan chan $ ClientMessage (ci, packet)