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:12:58 +0000 |
commit | bc7cd7887095d75f81c4f342c65de082725aec57 (patch) | |
tree | fb8aac58a2d2b6a8bbc46c58874c8d865233adef /src/p2p/net_node.inl | |
parent | Merge pull request #7058 (diff) | |
download | monero-bc7cd7887095d75f81c4f342c65de082725aec57.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 93a925971..adb07466f 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -2051,6 +2051,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; |