From 60a3221f0b4673452cccd658ef787ca144bb2140 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Wed, 7 Jun 2017 06:57:24 -0700 Subject: [PATCH] Fix chunk delimiter parsing --- CHANGELOG.md | 1 + include/beast/http/impl/basic_parser.ipp | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bbd62c0b..2ba59ce0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Version 50 * Fields concept work * Body documentation work * Add missing handler_alloc nested types +* Fix chunk delimiter parsing API Changes: diff --git a/include/beast/http/impl/basic_parser.ipp b/include/beast/http/impl/basic_parser.ipp index 6489592c..d1131926 100644 --- a/include/beast/http/impl/basic_parser.ipp +++ b/include/beast/http/impl/basic_parser.ipp @@ -512,11 +512,16 @@ parse_chunk_header(char const*& p, // be parsed in one call instead of two. if(f_ & flagExpectCRLF) { - if(n < 2 || ! parse_crlf(p)) + if(n < 2) { ec = error::need_more; return; } + if(! parse_crlf(p)) + { + ec = error::bad_chunk; + return; + } f_ &= ~flagExpectCRLF; pbegin += 2; n -= 2;