Commit b0aba763 authored by Mathieu STEFANI's avatar Mathieu STEFANI

Fixed unitialized data in the parser

parent 29c0f686
...@@ -24,6 +24,12 @@ static constexpr char CRLF[] = {CR, LF}; ...@@ -24,6 +24,12 @@ static constexpr char CRLF[] = {CR, LF};
namespace Private { namespace Private {
Parser::Buffer::Buffer()
: len(0)
{
memset(data, sizeof data, 0);
}
bool bool
Parser::Cursor::advance(size_t count) Parser::Cursor::advance(size_t count)
{ {
...@@ -114,11 +120,15 @@ namespace Private { ...@@ -114,11 +120,15 @@ namespace Private {
else if (tryMatch("DELETE")) { else if (tryMatch("DELETE")) {
request->method = Method::Delete; request->method = Method::Delete;
} }
else {
raise("Lol wat");
}
auto n = cursor.next(); auto n = cursor.next();
if (n == Cursor::Eof) return State::Again; if (n == Cursor::Eof) return State::Again;
else if (n != ' ') raise("Malformed HTTP Request"); else if (n != ' ') raise("Malformed HTTP Request");
if (!cursor.advance(2)) return State::Again; if (!cursor.advance(2)) return State::Again;
size_t start = cursor; size_t start = cursor;
......
...@@ -131,6 +131,8 @@ namespace Private { ...@@ -131,6 +131,8 @@ namespace Private {
struct Parser { struct Parser {
struct Buffer { struct Buffer {
Buffer();
char data[Const::MaxBuffer]; char data[Const::MaxBuffer];
size_t len; size_t len;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment