From 7e8aaf8ee06b3b15504f6e12c0e7734c5d4f7cc4 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Thu, 16 Oct 2014 15:22:46 +0200 Subject: [PATCH] Added check in HTTP::Parser::Read against empty connection buffers. --- lib/http_parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/http_parser.cpp b/lib/http_parser.cpp index 2ceda241..6b2da389 100644 --- a/lib/http_parser.cpp +++ b/lib/http_parser.cpp @@ -324,7 +324,7 @@ void HTTP::Parser::SetVar(std::string i, std::string v) { /// \return True if a whole request or response was read, false otherwise. bool HTTP::Parser::Read(Socket::Connection & conn) { //Make sure the received data ends in a newline (\n). - while ((!seenHeaders || (getChunks && !doingChunk)) && *(conn.Received().get().rbegin()) != '\n') { + while ((!seenHeaders || (getChunks && !doingChunk)) && conn.Received().get().size() && *(conn.Received().get().rbegin()) != '\n') { if (conn.Received().size() > 1) { //make a copy of the first part std::string tmp = conn.Received().get();