From 8c43554de6c7af90463852c2c59deca67cc1415f Mon Sep 17 00:00:00 2001 From: "yiteng.nyt" Date: Mon, 11 Jul 2016 12:38:10 +0800 Subject: [PATCH] fix rapidjson::value::Get() may returns wrong data Change-Id: Ia7325edb437e3039e29223d0ecc4d9c83d824bc0 --- include/rapidjson/document.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h index 17af92264..783479cb3 100644 --- a/include/rapidjson/document.h +++ b/include/rapidjson/document.h @@ -480,7 +480,7 @@ template struct TypeHelper > { typedef std::basic_string StringType; static bool Is(const ValueType& v) { return v.IsString(); } - static StringType Get(const ValueType& v) { return v.GetString(); } + static StringType Get(const ValueType& v) { return StringType(v.GetString(), v.GetStringLength()); } static ValueType& Set(ValueType& v, const StringType& data, typename ValueType::AllocatorType& a) { return v.SetString(data, a); } }; #endif