p2p: drop peers that spam peer lists

There's always some people who just want to abuse things
This commit is contained in:
moneromooo-monero 2020-12-04 13:59:51 +00:00
parent f83203ecef
commit bc7cd78870
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
2 changed files with 6 additions and 0 deletions

View file

@ -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;