Browse Source

Merge pull request #5843

ba04c4a Limit message sizes before transfer (Pieter Wuille)
pull/145/head
Wladimir J. van der Laan 9 years ago
parent
commit
51377c2dbe
No known key found for this signature in database GPG Key ID: 74810B012346C9A6
  1. 5
      src/net.cpp
  2. 2
      src/net.h

5
src/net.cpp

@ -523,6 +523,11 @@ bool CNode::ReceiveMsgBytes(const char *pch, unsigned int nBytes)
if (handled < 0)
return false;
if (msg.in_data && msg.hdr.nMessageSize > MAX_PROTOCOL_MESSAGE_LENGTH) {
LogPrint("net", "Oversized message from peer=%i, disconnecting", GetId());
return false;
}
pch += handled;
nBytes -= handled;

2
src/net.h

@ -46,6 +46,8 @@ static const int TIMEOUT_INTERVAL = 20 * 60;
static const unsigned int MAX_INV_SZ = 50000;
/** The maximum number of new addresses to accumulate before announcing. */
static const unsigned int MAX_ADDR_TO_SEND = 1000;
/** Maximum length of incoming protocol messages (no message over 2 MiB is currently acceptable). */
static const unsigned int MAX_PROTOCOL_MESSAGE_LENGTH = 2 * 1024 * 1024;
/** -listen default */
static const bool DEFAULT_LISTEN = true;
/** -upnp default */

Loading…
Cancel
Save