doc: net: mention past vulnerability as rationale to limit incoming message size

This commit is contained in:
Antoine Poinsot committed 2025-02-12 15:10:28 -05:00
1 parent 4489117c3f
commit ad616b6c01
1 file changed
+2
+2
View File
@@ -761,6 +761,8 @@ int V1Transport::readHeader(Span<const uint8_t> msg_bytes)
}
// reject messages larger than MAX_SIZE or MAX_PROTOCOL_MESSAGE_LENGTH
// NOTE: failing to perform this check previously allowed a malicious peer to make us allocate 32MiB of memory per
// connection. See https://bitcoincore.org/en/2024/07/03/disclose_receive_buffer_oom.
if (hdr.nMessageSize > MAX_SIZE || hdr.nMessageSize > MAX_PROTOCOL_MESSAGE_LENGTH) {
LogDebug(BCLog::NET, "Header error: Size too large (%s, %u bytes), peer=%d\n", SanitizeString(hdr.GetMessageType()), hdr.nMessageSize, m_node_id);
return -1;