diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2020-12-04 13:59:51 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2020-12-05 13:41:48 +0000 |
commit | 446b3c865bbc43169aaa37fad230e4cbb700aaed (patch) | |
tree | 8c247cd6583575dd9fcd6d8d61e403885739c5a9 /src/p2p/net_node.inl | |
parent | Merge pull request #7010 (diff) | |
download | monero-446b3c865bbc43169aaa37fad230e4cbb700aaed.tar.xz |
p2p: drop peers that spam peer lists
There's always some people who just want to abuse things
Diffstat (limited to 'src/p2p/net_node.inl')
-rw-r--r-- | src/p2p/net_node.inl | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index c71dfc2de..7dcc9d0bd 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -2060,6 +2060,11 @@ namespace nodetool template<class t_payload_net_handler> bool node_server<t_payload_net_handler>::handle_remote_peerlist(const std::vector<peerlist_entry>& peerlist, const epee::net_utils::connection_context_base& context) { + if (peerlist.size() > P2P_MAX_PEERS_IN_HANDSHAKE) + { + MWARNING(context << "peer sent " << peerlist.size() << " peers, considered spamming"); + return false; + } std::vector<peerlist_entry> peerlist_ = peerlist; if(!sanitize_peerlist(peerlist_)) return false; |