aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2022-04-25 10:22:31 -0500
committerluigi1111 <luigi1111w@gmail.com>2022-04-25 10:22:31 -0500
commit424e4de16b98506170db7b0d7d87a79ccf541744 (patch)
tree94c3bdc645883b373b93a6845a5692826cfcaf68 /src
parentMerge pull request #8273 (diff)
parentadd a sanity check to RPC input data size (diff)
downloadmonero-0.17.3.2.tar.xz
Merge pull request #8276v0.17.3.2v0.17.3.2
c624d05 add a sanity check to RPC input data size (moneromooo-monero)
Diffstat (limited to 'src')
-rw-r--r--src/cryptonote_config.h1
-rw-r--r--src/rpc/core_rpc_server.cpp2
2 files changed, 3 insertions, 0 deletions
diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h
index 80534fbc0..7c6a9a661 100644
--- a/src/cryptonote_config.h
+++ b/src/cryptonote_config.h
@@ -126,6 +126,7 @@
#define COMMAND_RPC_GET_BLOCKS_FAST_MAX_BLOCK_COUNT 1000
#define COMMAND_RPC_GET_BLOCKS_FAST_MAX_TX_COUNT 20000
+#define MAX_RPC_CONTENT_LENGTH 1048576 // 1 MB
#define P2P_LOCAL_WHITE_PEERLIST_LIMIT 1000
#define P2P_LOCAL_GRAY_PEERLIST_LIMIT 5000
diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp
index 757e73906..126616243 100644
--- a/src/rpc/core_rpc_server.cpp
+++ b/src/rpc/core_rpc_server.cpp
@@ -344,6 +344,8 @@ namespace cryptonote
if (m_rpc_payment)
m_net_server.add_idle_handler([this](){ return m_rpc_payment->on_idle(); }, 60 * 1000);
+ m_net_server.get_config_object().m_max_content_length = MAX_RPC_CONTENT_LENGTH;
+
auto rng = [](size_t len, uint8_t *ptr){ return crypto::rand(len, ptr); };
return epee::http_server_impl_base<core_rpc_server, connection_context>::init(
rng, std::move(port), std::move(bind_ip_str),