aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/net.cpp2
-rw-r--r--src/net.h3
-rw-r--r--src/protocol.cpp4
-rw-r--r--src/protocol.h2
-rw-r--r--src/test/fuzz/deserialize.cpp2
-rw-r--r--src/test/fuzz/p2p_transport_deserializer.cpp2
6 files changed, 7 insertions, 8 deletions
diff --git a/src/net.cpp b/src/net.cpp
index fdb76d3b83..1ae4b8fe08 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -2846,7 +2846,7 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn
LogPrint(BCLog::NET, "Added connection peer=%d\n", id);
}
- m_deserializer = MakeUnique<V1TransportDeserializer>(V1TransportDeserializer(Params().MessageStart(), GetId(), SER_NETWORK, INIT_PROTO_VERSION));
+ m_deserializer = MakeUnique<V1TransportDeserializer>(V1TransportDeserializer(GetId(), SER_NETWORK, INIT_PROTO_VERSION));
m_serializer = MakeUnique<V1TransportSerializer>(V1TransportSerializer());
}
diff --git a/src/net.h b/src/net.h
index f581ce8ff9..cec201c5d2 100644
--- a/src/net.h
+++ b/src/net.h
@@ -765,10 +765,9 @@ private:
}
public:
- V1TransportDeserializer(const CMessageHeader::MessageStartChars& pchMessageStartIn, const NodeId node_id, int nTypeIn, int nVersionIn)
+ V1TransportDeserializer(const NodeId node_id, int nTypeIn, int nVersionIn)
: m_node_id(node_id),
hdrbuf(nTypeIn, nVersionIn),
- hdr(pchMessageStartIn),
vRecv(nTypeIn, nVersionIn)
{
Reset();
diff --git a/src/protocol.cpp b/src/protocol.cpp
index 48ca0c6df6..6b4de68ce9 100644
--- a/src/protocol.cpp
+++ b/src/protocol.cpp
@@ -84,9 +84,9 @@ const static std::string allNetMessageTypes[] = {
};
const static std::vector<std::string> allNetMessageTypesVec(allNetMessageTypes, allNetMessageTypes+ARRAYLEN(allNetMessageTypes));
-CMessageHeader::CMessageHeader(const MessageStartChars& pchMessageStartIn)
+CMessageHeader::CMessageHeader()
{
- memcpy(pchMessageStart, pchMessageStartIn, MESSAGE_START_SIZE);
+ memset(pchMessageStart, 0, MESSAGE_START_SIZE);
memset(pchCommand, 0, sizeof(pchCommand));
nMessageSize = -1;
memset(pchChecksum, 0, CHECKSUM_SIZE);
diff --git a/src/protocol.h b/src/protocol.h
index 7fb84cddf1..3bf0797ca4 100644
--- a/src/protocol.h
+++ b/src/protocol.h
@@ -37,7 +37,7 @@ public:
static constexpr size_t HEADER_SIZE = MESSAGE_START_SIZE + COMMAND_SIZE + MESSAGE_SIZE_SIZE + CHECKSUM_SIZE;
typedef unsigned char MessageStartChars[MESSAGE_START_SIZE];
- explicit CMessageHeader(const MessageStartChars& pchMessageStartIn);
+ explicit CMessageHeader();
/** Construct a P2P message header from message-start characters, a command and the size of the message.
* @note Passing in a `pszCommand` longer than COMMAND_SIZE will result in a run-time assertion error.
diff --git a/src/test/fuzz/deserialize.cpp b/src/test/fuzz/deserialize.cpp
index 54793c890f..f87b7576a4 100644
--- a/src/test/fuzz/deserialize.cpp
+++ b/src/test/fuzz/deserialize.cpp
@@ -190,7 +190,7 @@ void test_one_input(const std::vector<uint8_t>& buffer)
AssertEqualAfterSerializeDeserialize(s);
#elif MESSAGEHEADER_DESERIALIZE
const CMessageHeader::MessageStartChars pchMessageStart = {0x00, 0x00, 0x00, 0x00};
- CMessageHeader mh(pchMessageStart);
+ CMessageHeader mh;
DeserializeFromFuzzingInput(buffer, mh);
(void)mh.IsValid(pchMessageStart);
#elif ADDRESS_DESERIALIZE
diff --git a/src/test/fuzz/p2p_transport_deserializer.cpp b/src/test/fuzz/p2p_transport_deserializer.cpp
index 3e9cd3af38..5349fd3f68 100644
--- a/src/test/fuzz/p2p_transport_deserializer.cpp
+++ b/src/test/fuzz/p2p_transport_deserializer.cpp
@@ -20,7 +20,7 @@ void initialize()
void test_one_input(const std::vector<uint8_t>& buffer)
{
// Construct deserializer, with a dummy NodeId
- V1TransportDeserializer deserializer{Params().MessageStart(), (NodeId)0, SER_NETWORK, INIT_PROTO_VERSION};
+ V1TransportDeserializer deserializer{(NodeId)0, SER_NETWORK, INIT_PROTO_VERSION};
const char* pch = (const char*)buffer.data();
size_t n_bytes = buffer.size();
while (n_bytes > 0) {