diff --git a/src/server/poolserver/Stratum/Client.cpp b/src/server/poolserver/Stratum/Client.cpp index 4942d59..0ad8f23 100644 --- a/src/server/poolserver/Stratum/Client.cpp +++ b/src/server/poolserver/Stratum/Client.cpp @@ -388,6 +388,10 @@ namespace Stratum } else _recvMessage += c; } + + // Check if message doesn't exceed maximum packet size + if (_recvMessage.size() > MAX_PACKET) + Disconnect(); StartRead(); } else { diff --git a/src/server/poolserver/Stratum/Server.h b/src/server/poolserver/Stratum/Server.h index a77246a..208b10d 100644 --- a/src/server/poolserver/Stratum/Server.h +++ b/src/server/poolserver/Stratum/Server.h @@ -18,6 +18,8 @@ #include #include +#define MAX_PACKET 4096 + using namespace boost; using namespace boost::asio::ip;