mirror of
https://github.com/matrix-construct/construct
synced 2024-12-27 07:54:05 +01:00
ircd::server: Use pessimistic buffer minimum condition to fail faster.
This commit is contained in:
parent
33a2d3ff6d
commit
41545edef2
1 changed files with 4 additions and 2 deletions
|
@ -3770,7 +3770,8 @@ const
|
||||||
const auto &req{*request};
|
const auto &req{*request};
|
||||||
const auto &content{req.in.content};
|
const auto &content{req.in.content};
|
||||||
|
|
||||||
if(unlikely(size(content) <= state.content_read))
|
static const size_t buf_min {16};
|
||||||
|
if(unlikely(size(content) <= state.content_read + buf_min))
|
||||||
throw buffer_overrun
|
throw buffer_overrun
|
||||||
{
|
{
|
||||||
"Content buffer of %zu bytes too small to read next chunk header",
|
"Content buffer of %zu bytes too small to read next chunk header",
|
||||||
|
@ -3865,7 +3866,8 @@ const
|
||||||
};
|
};
|
||||||
|
|
||||||
assert(head_max >= head_offset);
|
assert(head_max >= head_offset);
|
||||||
if(unlikely(head_max - head_offset <= 16))
|
static const size_t buf_min {16};
|
||||||
|
if(unlikely(head_max - head_offset <= buf_min))
|
||||||
throw buffer_overrun
|
throw buffer_overrun
|
||||||
{
|
{
|
||||||
"Remaining head buffer of %zu bytes too small to read next chunk header",
|
"Remaining head buffer of %zu bytes too small to read next chunk header",
|
||||||
|
|
Loading…
Reference in a new issue