summaryrefslogtreecommitdiff
path: root/contrib/epee/include/net/http_protocol_handler.inl
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 /contrib/epee/include/net/http_protocol_handler.inl
parent809b13192b05e671edbd3bdff389747db22770c7 (diff)
parentc624d05de6b59fdd4b249ecd27e86d08c8684ffb (diff)
downloadmonzero-core-0.17.3.2.tar.gz
monzero-core-0.17.3.2.tar.xz
monzero-core-0.17.3.2.zip
Merge pull request #8276v0.17.3.2
c624d05 add a sanity check to RPC input data size (moneromooo-monero)
Diffstat (limited to 'contrib/epee/include/net/http_protocol_handler.inl')
-rw-r--r--contrib/epee/include/net/http_protocol_handler.inl10
1 files changed, 10 insertions, 0 deletions
diff --git a/contrib/epee/include/net/http_protocol_handler.inl b/contrib/epee/include/net/http_protocol_handler.inl
index 0f4a28c99..de806fad4 100644
--- a/contrib/epee/include/net/http_protocol_handler.inl
+++ b/contrib/epee/include/net/http_protocol_handler.inl
@@ -206,6 +206,7 @@ namespace net_utils
m_config(config),
m_want_close(false),
m_newlines(0),
+ m_bytes_read(0),
m_psnd_hndlr(psnd_hndlr),
m_conn_context(conn_context)
{
@@ -221,6 +222,7 @@ namespace net_utils
m_query_info.clear();
m_len_summary = 0;
m_newlines = 0;
+ m_bytes_read = 0;
return true;
}
//--------------------------------------------------------------------------------------------
@@ -243,6 +245,14 @@ namespace net_utils
size_t ndel;
+ m_bytes_read += buf.size();
+ if (m_bytes_read > m_config.m_max_content_length)
+ {
+ LOG_ERROR("simple_http_connection_handler::handle_buff_in: Too much data: got " << m_bytes_read);
+ m_state = http_state_error;
+ return false;
+ }
+
if(m_cache.size())
m_cache += buf;
else