Skip to content

Commit 53e0c8f

Browse files
committed
Merge pull request #10467
b3b9842 zmq: add missing restricted rpc check for get_block_headers_by_height (Jeetraj)
2 parents 3ad4a5e + b3b9842 commit 53e0c8f

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/rpc/daemon_handler.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ constexpr size_t restricted_max_fake_outs = 5000;
5050
constexpr auto restricted_histogram_cutoff = std::chrono::hours{3 * 24};
5151
constexpr size_t restricted_max_txs = 100;
5252
constexpr size_t restricted_max_key_images = 5000;
53+
constexpr size_t restricted_max_block_headers = 1000;
5354
}
5455

5556
namespace cryptonote
@@ -697,6 +698,13 @@ namespace rpc
697698

698699
void DaemonHandler::handle(const GetBlockHeadersByHeight::Request& req, GetBlockHeadersByHeight::Response& res)
699700
{
701+
if (m_restricted && req.heights.size() > restricted_max_block_headers)
702+
{
703+
res.status = Message::STATUS_FAILED;
704+
res.error_details = "Too many block headers requested in restricted mode";
705+
return;
706+
}
707+
700708
res.headers.resize(req.heights.size());
701709

702710
for (size_t i=0; i < req.heights.size(); i++)

0 commit comments

Comments
 (0)