Fixed bug in r_string: end of string pointer was not updated in the force member function

This could lead to undefined behaviour in the std::string conversion
operator, when using the iterator interface (begin() / end()), and the size()
member function.
This commit is contained in:
Erik Åldstedt Sund 2017-10-23 23:16:16 +02:00
parent 7f3f72441c
commit 29824c84ed

View File

@ -168,9 +168,10 @@ namespace crow
return os;
}
private:
void force(char* s, uint32_t /*length*/)
void force(char* s, uint32_t length)
{
s_ = s;
e_ = s_ + length;
owned_ = 1;
}
friend rvalue crow::json::load(const char* data, size_t size);