From 671c9495d946ca1aa42bbc058c7407ff3556f0b1 Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 27 Nov 2015 20:05:48 +0000 Subject: [PATCH] Return the full string when requested from a flatbuffers::String, even if it contains a NULL byte. --- include/flatbuffers/flatbuffers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h index a728a79cf..c2b938d36 100644 --- a/include/flatbuffers/flatbuffers.h +++ b/include/flatbuffers/flatbuffers.h @@ -379,7 +379,7 @@ template static inline size_t VectorLength(const Vector *v) { struct String : public Vector { const char *c_str() const { return reinterpret_cast(Data()); } - std::string str() const { return c_str(); } + std::string str() const { return std::string(c_str(), Length()); } bool operator <(const String &o) const { return strcmp(c_str(), o.c_str()) < 0;