aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/net.cpp11
-rw-r--r--src/net.h5
2 files changed, 3 insertions, 13 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 210258c25a..8b9ef1d0aa 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -577,12 +577,6 @@ bool CNode::ReceiveMsgBytes(const char *pch, unsigned int nBytes, bool& complete
return false;
}
- if (m_deserializer->OversizedMessageDetected()) {
- LogPrint(BCLog::NET, "Oversized message from peer=%i, disconnecting\n", GetId());
- m_deserializer->Reset();
- return false;
- }
-
pch += handled;
nBytes -= handled;
@@ -655,9 +649,10 @@ int V1TransportDeserializer::readHeader(const char *pch, unsigned int nBytes)
return -1;
}
- // reject messages larger than MAX_SIZE
- if (hdr.nMessageSize > MAX_SIZE)
+ // reject messages larger than MAX_SIZE or MAX_PROTOCOL_MESSAGE_LENGTH
+ if (hdr.nMessageSize > MAX_SIZE || hdr.nMessageSize > MAX_PROTOCOL_MESSAGE_LENGTH) {
return -1;
+ }
// switch state to reading message data
in_data = true;
diff --git a/src/net.h b/src/net.h
index 6122508471..570ae83465 100644
--- a/src/net.h
+++ b/src/net.h
@@ -642,8 +642,6 @@ public:
virtual void Reset() = 0;
// returns true if the current deserialization is complete
virtual bool Complete() const = 0;
- // checks if the potential message in deserialization is oversized
- virtual bool OversizedMessageDetected() const = 0;
// set the serialization context version
virtual void SetVersion(int version) = 0;
// read and deserialize data
@@ -695,9 +693,6 @@ public:
hdrbuf.SetVersion(nVersionIn);
vRecv.SetVersion(nVersionIn);
}
- bool OversizedMessageDetected() const {
- return (in_data && hdr.nMessageSize > MAX_PROTOCOL_MESSAGE_LENGTH);
- }
int Read(const char *pch, unsigned int nBytes) {
return in_data ? readData(pch, nBytes) : readHeader(pch, nBytes);
}