diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-12-07 22:22:14 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-12-18 15:15:07 +0000 |
commit | 46d6fa35c9c3f5257a31bc4dae89a102a441831b (patch) | |
tree | 29e1959744eb726d8af6a92e8597eac23d57ba22 /src/cryptonote_protocol/cryptonote_protocol_handler.inl | |
parent | cryptonote_protocol: print peer versions when unexpected (diff) | |
download | monero-46d6fa35c9c3f5257a31bc4dae89a102a441831b.tar.xz |
cryptonote_protocol: sanity check chain hashes from peer
Diffstat (limited to '')
-rw-r--r-- | src/cryptonote_protocol/cryptonote_protocol_handler.inl | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl index dbcc4eba1..de30df5d7 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl +++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl @@ -1585,6 +1585,12 @@ skip: drop_connection(context, true, false); return 1; } + if (arg.total_height < arg.m_block_ids.size() || arg.start_height > arg.total_height - arg.m_block_ids.size()) + { + LOG_ERROR_CCONTEXT("sent invalid start/nblocks/height, dropping connection"); + drop_connection(context, true, false); + return 1; + } context.m_remote_blockchain_height = arg.total_height; context.m_last_response_height = arg.start_height + arg.m_block_ids.size()-1; |