From aae4bf32aa0f2d64223b59363ea43c448ded0d41 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Tue, 3 Nov 2020 12:59:36 +0000 Subject: [PATCH] protocol: reject empty incoming block messages --- src/cryptonote_protocol/cryptonote_protocol_handler.inl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl index c0a18789a..6027d3cab 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl +++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl @@ -1091,6 +1091,13 @@ namespace cryptonote //epee::net_utils::network_throttle_manager::get_global_throttle_inreq().logger_handle_net("log/dr-monero/net/req-all.data", sec, get_avg_block_size()); + if(arg.blocks.empty()) + { + LOG_ERROR_CCONTEXT("sent wrong NOTIFY_HAVE_OBJECTS: no blocks"); + drop_connection(context, true, false); + ++m_sync_bad_spans_downloaded; + return 1; + } if(context.m_last_response_height > arg.current_blockchain_height) { LOG_ERROR_CCONTEXT("sent wrong NOTIFY_HAVE_OBJECTS: arg.m_current_blockchain_height=" << arg.current_blockchain_height