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:
Vinnie Falco committed 2017-07-20 08:12:07 -07:00
1 parent 236f9598ce
commit bfb840fe8e
2 files changed
+16 -4

No files matched your search

+4 -2
View File
@@ -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))