File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -523,6 +523,11 @@ bool CNode::ReceiveMsgBytes(const char *pch, unsigned int nBytes)
523523 if (handled < 0 )
524524 return false ;
525525
526+ if (msg.in_data && msg.hdr .nMessageSize > MAX_PROTOCOL_MESSAGE_LENGTH) {
527+ LogPrint (" net" , " Oversized message from peer=%i, disconnecting" , GetId ());
528+ return false ;
529+ }
530+
526531 pch += handled;
527532 nBytes -= handled;
528533
Original file line number Diff line number Diff line change @@ -46,6 +46,8 @@ static const int TIMEOUT_INTERVAL = 20 * 60;
4646static const unsigned int MAX_INV_SZ = 50000 ;
4747/* * The maximum number of new addresses to accumulate before announcing. */
4848static const unsigned int MAX_ADDR_TO_SEND = 1000 ;
49+ /* * Maximum length of incoming protocol messages (no message over 2 MiB is currently acceptable). */
50+ static const unsigned int MAX_PROTOCOL_MESSAGE_LENGTH = 2 * 1024 * 1024 ;
4951/* * -listen default */
5052static const bool DEFAULT_LISTEN = true ;
5153/* * -upnp default */
You can’t perform that action at this time.
0 commit comments