aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Blair <snipa@jagtech.io>2020-12-10 17:43:41 -0800
committerAlexander Blair <snipa@jagtech.io>2020-12-10 17:43:41 -0800
commitbdaadf85dc34da357fcc0248ae15aa4ea803ea41 (patch)
tree121125613c745b9f7874959463dc3a34fa50c0e1
parentMerge pull request #7114 (diff)
parentprotocol: add a sanity check to the number of block hashes sent (diff)
downloadmonero-bdaadf85dc34da357fcc0248ae15aa4ea803ea41.tar.xz
Merge pull request #7117
5dee031b2 protocol: add a sanity check to the number of block hashes sent (moneromooo-monero)
-rw-r--r--src/cryptonote_config.h1
-rw-r--r--src/cryptonote_protocol/cryptonote_protocol_handler.inl2
2 files changed, 2 insertions, 1 deletions
diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h
index 13f0c471b..21f2bf81e 100644
--- a/src/cryptonote_config.h
+++ b/src/cryptonote_config.h
@@ -93,6 +93,7 @@
#define BLOCKS_IDS_SYNCHRONIZING_DEFAULT_COUNT 10000 //by default, blocks ids count in synchronizing
+#define BLOCKS_IDS_SYNCHRONIZING_MAX_COUNT 25000 //max blocks ids count in synchronizing
#define BLOCKS_SYNCHRONIZING_DEFAULT_COUNT_PRE_V4 100 //by default, blocks count in blocks downloading
#define BLOCKS_SYNCHRONIZING_DEFAULT_COUNT 20 //by default, blocks count in blocks downloading
#define BLOCKS_SYNCHRONIZING_MAX_COUNT 2048 //must be a power of 2, greater than 128, equal to SEEDHASH_EPOCH_BLOCKS
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
index a4a433861..efc239202 100644
--- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl
+++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl
@@ -2505,7 +2505,7 @@ skip:
}
MDEBUG(context << "first block hash " << arg.m_block_ids.front() << ", last " << arg.m_block_ids.back());
- if (arg.total_height >= CRYPTONOTE_MAX_BLOCK_NUMBER || arg.m_block_ids.size() >= CRYPTONOTE_MAX_BLOCK_NUMBER)
+ if (arg.total_height >= CRYPTONOTE_MAX_BLOCK_NUMBER || arg.m_block_ids.size() > BLOCKS_IDS_SYNCHRONIZING_MAX_COUNT)
{
LOG_ERROR_CCONTEXT("sent wrong NOTIFY_RESPONSE_CHAIN_ENTRY, with total_height=" << arg.total_height << " and block_ids=" << arg.m_block_ids.size());
drop_connection(context, false, false);