From 29824c84ede1a696851a6aae99eeae64f9651fc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20=C3=85ldstedt=20Sund?= Date: Mon, 23 Oct 2017 23:16:16 +0200 Subject: [PATCH] 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. --- include/crow/json.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/crow/json.h b/include/crow/json.h index d8dbace7f..1aa303eed 100644 --- a/include/crow/json.h +++ b/include/crow/json.h @@ -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);