mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Fix parser off by one accessing buffer bug:
This fixed a bug where in some cases the parser could dereference past the end of the caller provided buffer. The unit test is improved to allocate memory in separate pieces for the split-buffer matrix test, to give address-sanitizer more to work with.
This commit is contained in:
@@ -463,8 +463,9 @@ write(boost::asio::const_buffer const& buffer, error_code& ec)
|
||||
|
||||
case s_header_field:
|
||||
{
|
||||
for(; p != end; ch = *++p)
|
||||
for(; p != end; ++p)
|
||||
{
|
||||
ch = *p;
|
||||
auto c = to_field_char(ch);
|
||||
if(! c)
|
||||
break;
|
||||
@@ -660,8 +661,9 @@ write(boost::asio::const_buffer const& buffer, error_code& ec)
|
||||
|
||||
case s_header_value_text:
|
||||
{
|
||||
for(; p != end; ch = *++p)
|
||||
for(; p != end; ++p)
|
||||
{
|
||||
ch = *p;
|
||||
if(ch == '\r')
|
||||
{
|
||||
if(cb(nullptr))
|
||||
|
||||
Reference in New Issue
Block a user