mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 14:59:39 -04:00
doc: net: mention past vulnerability as rationale to limit incoming message size
This commit is contained in:
parent
4489117c3f
commit
ad616b6c01
1 changed files with 2 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue