aboutsummaryrefslogtreecommitdiff
path: root/src/p2p/net_node.inl
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2020-12-07 10:24:30 -0600
committerluigi1111 <luigi1111w@gmail.com>2020-12-07 10:24:30 -0600
commitb7425c14c8e7f2fda81d345829ff7e1bc0c382d3 (patch)
tree3a2d6b13c19b5cc05c6c28521e08885954475ee8 /src/p2p/net_node.inl
parentMerge pull request #7070 (diff)
parentp2p: drop peers that spam peer lists (diff)
downloadmonero-b7425c14c8e7f2fda81d345829ff7e1bc0c382d3.tar.xz
Merge pull request #7072
bc7cd78 p2p: drop peers that spam peer lists (moneromooo-monero)
Diffstat (limited to 'src/p2p/net_node.inl')
-rw-r--r--src/p2p/net_node.inl5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl
index cec037916..8000835c4 100644
--- a/src/p2p/net_node.inl
+++ b/src/p2p/net_node.inl
@@ -2064,6 +2064,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;